unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  s:string;
  ma:integer;
implementation

{$R *.dfm}


Function vozr(s:string):string;
  var n,i,j,ai:integer;
  a:array[1..100] of integer;
 begin
  i:=1;
  while (length(s)>0) and (pos(' ',s)>0) do begin
   n:=pos(' ',s);
   a[i]:=StrToInt(copy(s,1,n-1));
   delete(s,1,n);
   i:=i+1;
  end;
  a[i]:=StrToInt(s);
  repeat
   j:=0;
   for n:=1 to i-1 do
    if a[n+1]<a[n] then begin
                         ai:=a[n];
                         a[n]:=a[n+1];
                         a[n+1]:=ai;
                         j:=j+1;
                        end;
   until j<=0;
  result:=IntToStr(a[1]);
  for n:=2 to i do
   result:=result+' '+IntToStr(a[n]);
 end;



procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
s:=trim(Edit1.Text);

if key=#13 then
 begin
  ma:=1;
  while ma<length(s) do
    begin
     if s[ma]<>' ' then ma:=ma+1 else
      if s[ma+1]<>' '  then ma:=ma+1 else
        delete(s,ma,1);
    end;

 Edit1.Text:=vozr(s);
 end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Clear;
end;

end.
