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