Ввести строку, в которой слова разделены пробелом, если в каком то из слове встретилась буква b, то вывести это слово на экран — Pascal(Паскаль)

uses crt;
var  st,buf:string;
begin
 clrscr;
 write('-> ');
 readln(st);
 repeat
  if (st[1]=' ') or (length(st)=0) then while st[1]=' ' do delete(st,1,1)
  else
  begin
   while (st[1]<>' ') and (length(st)>0) do
   begin
    buf:=buf+st[1];
    delete(st,1,1);
   end;
  if (pos('b',buf)>0) or (pos('B',buf)>0) then write(buf,' ');
  buf:='';
  end;
 until (length(st)=0) and (length(buf)=0);
 readln;
end.

Leave a Comment

5 + 4 =