fork download
  1. var
  2. s1, s2: string;
  3. p1, p2: integer;
  4. begin
  5. readln(s1);
  6. readln(s2);
  7. //
  8. p1 := length(s1) + 1;
  9. p2 := 1;
  10. while (p2 <= length(s2)) do begin
  11. //
  12. dec(p1);
  13. while (1 <= p1) do
  14. if (s1[p1] = s2[p2]) then
  15. break
  16. else
  17. dec(p1);
  18. //
  19. if (1 > p1) then
  20. break;
  21. //
  22. inc(p2);
  23. end;
  24. //
  25. if (1 > p1) then
  26. writeln('не имеется')
  27. else
  28. writeln('имеется');
  29. end.
  30.  
Success #stdin #stdout 0.01s 4112KB
stdin
hello
olehh

stdout
не имеется