uses crt;
var st, buf:string;
i, j, N:integer;
f:boolean;
slova: array[1..200]of string;
begin
N := 0;
write('-> ');
readln(st);
buf:='';
for i:=1 to length(st) do
begin
if st[i]<>' ' then
begin
buf := buf + st[i];
f:=true;
end else begin
if f then
begin
inc(N);
slova[N] := buf;
f := false;
end;
buf := '';
end;
end;
if buf<>'' then
begin
inc(N);
slova[N] := buf;
buf:='';
end;
for i := N downto 1 do
for j := 1 to i-1 do if slova[j] > slova[j+1] then
begin
buf := slova[j];
slova[j] := slova[j+1];
slova[j+1] := buf;
end;
writeln('Отсортированный список слов: ');
for i:=1 to N do writeln(slova[i]);
readln;
end.