fork download
  1. program antivirus;
  2.  
  3. var
  4. M, N1, N2, N3, N4, T, p1, p2, p3, p4, test, i : LongInt;
  5. F1, F2, F3, F4 : AnsiString;
  6. corrispondenza : boolean;
  7.  
  8. begin
  9.  
  10.  
  11. ReadLn(T);
  12. for test:=1 to T do begin
  13. ReadLn();
  14. ReadLn(N1, N2, N3, N4);
  15.  
  16. ReadLn(M);
  17.  
  18. ReadLn(F1);
  19.  
  20. ReadLn(F2);
  21.  
  22. ReadLn(F3);
  23.  
  24. ReadLn(F4);
  25.  
  26. for p1:= 1 to N1-M+1 do
  27. for p2:= 1 to N2-M +1 do
  28. for p3:=1 to N3-M +1 do
  29. for p4:= 1 to N4-M+1 do
  30. begin
  31. corrispondenza:=true;
  32. for i:= 0 to M -1 do
  33. if (F1[p1 + i] <> F2[p2 + i]) or ( F2[p2 + i] <> F3[p3 + i]) or (F3[p3 + i] <> F4[p4 + i]) then begin corrispondenza:= false; continue; end;
  34. if corrispondenza=true then
  35. begin
  36. Write('Case #', test, ': ');
  37. WriteLn(p1-1, ' ', p2-1, ' ', p3-1, ' ', p4-1);
  38. continue;
  39. end;
  40. end;
  41. end;
  42. end.
  43.  
Success #stdin #stdout 0.01s 5284KB
stdin
2

8 12 10 7
4
ananasso
associazione
tassonomia
massone

6 9 11 10
3
simone
ponessimo
milionesimo
cassonetto
stdout
Case #1: 4 0 1 1
Case #2: 3 1 4 4