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.   decommenta le due righe seguenti se vuoi leggere/scrivere da file
  11.   assign(input, 'input.txt'); reset(input);
  12.   assign(output, 'output.txt'); rewrite(output);
  13. }
  14.  
  15. ReadLn(T);
  16. for test:=1 to T do begin
  17. ReadLn();
  18. ReadLn(N1, N2, N3, N4);
  19.  
  20. ReadLn(M);
  21.  
  22. ReadLn(F1);
  23.  
  24. ReadLn(F2);
  25.  
  26. ReadLn(F3);
  27.  
  28. ReadLn(F4);
  29.  
  30. for p1:= 1 to N1-M do
  31. for p2:= 1 to N2-M do
  32. for p3:=1 to N3-M do
  33. for p4:= 1 to N4-M do
  34. begin
  35. corrispondenza:=true;
  36. for i:= 0 to M do
  37. 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
  38.  
  39.  
  40. else if corrispondenza=true then
  41. begin
  42. Write('Case #', test, ': ');
  43. WriteLn(p1-1, ' ', p2-1, ' ', p3-1, ' ', p4-1);
  44. end;
  45. end;
  46. end;
  47. end.
Success #stdin #stdout 0s 5288KB
stdin
2

8 12 10 7
4
ananasso
associazione
tassonomia
massone

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