uses crt;
const n=5;
type number=array[1..n] of char;
var a:number;i,j:integer;
function check(var a:number):boolean;
   var z:boolean;
   begin
   z:=true;
   for i:=1 to n do
     if (a[i]<'0')or (a[i]>'9') then
     z:=false;
     check:=z;
   end;
procedure exchange(var a,b:char);
  var z:char;
  begin
  z:=a;
  a:=b;
  b:=z;
  end;
 begin
 {repeat}
 clrscr;
{writeln('vvedite chislo');}
 for i:=1 to n do
 begin
 a[i]:=readkey;
 write(a[i]);
 end;
 writeln;
 if check(a) then
    begin
     for i:=1 to n-1 do
       for j:=i to n do
        if a[j]>a[i] then exchange(a[i],a[j])
     end
 else writeln('nevernii vvod');
 for i:=1 to n do
  write(a[i]);
  readln;
{writeln('  repeat? ');
until readkey='n';}
 end.