fork(1) download
  1. program task_d;
  2. var count_sym, i, counter: integer;
  3. n,n_1, p,r:string;
  4. begin
  5. readln(p);
  6. readln(r);
  7. count_sym := 1;
  8. counter := 1;
  9. for i:=1 to length(r) do
  10. begin
  11. n := Copy(r, i, count_sym);
  12. n_1 := Copy(r, i, count_sym+1);
  13. if (Pos(n, p)<>0 ) and (Pos(n_1, p)=0) then
  14. begin
  15. count_sym := 1;
  16. counter:=counter+1;
  17. end
  18. else count_sym := count_sym+1;
  19.  
  20. end;
  21.  
  22. writeln(counter);
  23. end.
Success #stdin #stdout 0s 276KB
stdin
aba
abaabaaba
stdout
5