{вот правильное решение я там забыл то чтобы подсчитывать число букв a} var s: string; i, id, len, max, count,q: byte; begin q:=0; readln(s); len := length(s); max := 0; id := 0; count := 0; for i:=1 to len do if s[i] <> ' ' then count := count + 1 else begin if count > max then begin max := count; id := i - count; end; count := 0 end; if count > max then begin max := count; id := i - count; end; for i:=id to id+max do if s[i] = 'a' then begin q:=q+1; s[i] := 'b'; writeln(s,' ' , q); end; end.
var s: string;
i, id, len, max, count,q: byte;
begin
q:=0;
readln(s);
len := length(s);
max := 0;
id := 0;
count := 0;
for i:=1 to len do
if s[i] <> ' ' then count := count + 1
else begin
if count > max then begin
max := count;
id := i - count;
end;
count := 0
end;
if count > max then begin
max := count;
id := i - count;
end;
for i:=id to id+max do
if s[i] = 'a' then begin q:=q+1; s[i] := 'b';
writeln(s,' ' , q);
end;
end.