Uses Crt; Var s1, s2: String; i, j, k, h, L1, L2: Integer; DoIt: Boolean; begin ClrScr; Write('input S1: '); ReadLn(s1); { s1 := 'this is a t -e -s -t -'; } L1 := Length(s1); Write('input S2: '); ReadLn(s2);} { s2 := 'test'; } L2 := Length(s2); k := 0; For h := 1 To L1 Do If (h = 1) or (L2 > 1) Then For i := 1 To L1 - Pred(L2) * h Do If s1[i] = s2[1] Then Begin DoIt := True; j := 2; While (j <= L2) and DoIt Do Begin DoIt := s1[i + Pred(j) * h] = s2[j]; inc(j) End; If DoIt Then Begin Write('step: ',Pred(h):2, ' position: ', i); For k := 1 To Pred(L2) Do Write('-',i + k * h); WriteLn; k := 1 End; End; If k = 0 Then WriteLn('string S2 not exists in S1'); ReadLn end.