Var
s: string;
p, nb: integer;
begin
write('text? ');
readln(s);
p := 1;
while p <= length(s) do begin </span>
while (s[p] = ' ') and (p <= length(s)) do inc(p); </span>
if (p <= length(s)) and (s[p] = 'b') then inc(nb); </span>
while (s[p] <> ' ') and (p <= length(s)) do inc(p); </span>
end;
write('num words: ', nb);
end.