uses
crt;
const
dividers = [' ', ',', '.', ';', ':', '-', '=', '+']; { дописать нужные }
var
s, temp: string;
i, j, c, ca: integer;
begin
clrscr;
writeln('Введите строку:');
readln(s);
temp := '';
c := 0;
ca := 0;
{ пробегаем всю строку посимвольно }
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)) then
begin
if temp <> '' then
begin
if temp[1] in ['б', 'Б'] then
inc(ca);
if temp[1] = temp[length(temp)] then
inc(c);
temp := ''
end;
end;
end;
writeln('Количество слов начинающихся с буквы "б": ', ca);
writeln('Всего слов у которых равны первая и последняя буквы: ', c)
end.