program kkk;
uses crt;
var count,i,j:integer;
st,buf:string;
slova:array[1..100]of string;
begin
clrscr;
write('Введите строку -> ');
readln(st);
count:=1;
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;
slova[count]:=buf;
buf:='';
inc(count);
end;
until (length(st)=0) and (length(buf)=0);
for i:=1 to count-1 do
for j:=1 to count-2 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 count-1 do write(slova[i],' ');
readln;
end.