Дано n строк. Для каждой строки найти и распечатать количество слов начинающихся и заканчивающихся одинаковой буквой — Pascal(Паскаль)

uses
  Crt;
const
  dividers = [' ',',','.',';',':','-','=','+'];
var
  s,temp: string;
  i: byte;
begin
  ClrScr;
  ReadLn(s);
  temp := '';
  WriteLn('Result: ');
  for i := 1 to Length(s) do
  begin
    if not (s[i] in dividers) then
      temp := temp + s[i];
    if ((s[i] in dividers) or (i = Length(s))) and (temp <> '') then
    begin
      if temp[1] = temp[Length(temp)] then
        Write(temp, ' ');
      temp := '';
    end
  end;
  ReadLn
end.

Leave a Comment

4 + = 11