Advertisement
dxvmxnd

Untitled

Dec 1st, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. program Project3;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8. System.SysUtils;
  9.  
  10. var
  11. str : String;
  12. word : String;
  13. i, x : integer;
  14. maxres : integer;
  15. res : integer;
  16. isCorrect : boolean;
  17. hitler : integer;
  18.  
  19. begin
  20.  
  21. str := 'fjfjfjfjjfjfjfjf qeqeeqeq rtrttrtr  ';
  22. str := str + ' ';
  23. x := 1;
  24. while (x <= length(str)) do
  25. begin
  26. maxres := 0;
  27. res := 0;
  28. isCorrect := false;
  29. word := '';
  30. hitler := 0;
  31. while (str[x] <> ' ') do
  32. begin
  33. word := word + str[x];
  34. inc(res);
  35. inc(x)
  36. end;
  37.  
  38. writeln('', word);
  39.  
  40. for i := 1 to (length(word) div 2 + 1) do
  41. begin
  42. if (word[i] = word[word.Length - i + 1]) then
  43. inc(hitler);
  44. end;
  45.  
  46. if hitler = (length(word) div 2 + 1) then
  47. begin
  48. if maxres < res then
  49. maxres := res;
  50. writeln(word, ' - симметричное слово!');
  51. end;
  52.  
  53.  
  54.  
  55. inc(x);
  56. end;
  57.  
  58. writeln('maxres', maxres);
  59.  
  60.  
  61.  
  62.  
  63.  
  64. readln;
  65. end.
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement