Pascal
Var
a:array[1..4] of integer;
b,i,i2,max:integer;
Begin
Readln(b);
a[1]:= b div 1000;
a[2]:= b div 100 mod 10;
a[3]:= b div 10 mod 10;
a[4]:= b mod 10;
max:=1;
for i2:=1 to 4 do begin
for i:=1 to 4 do if a[max]<a[i] then max:=i;Write(a[max]);
a[max]:=0;
End;
End
Pascal
Var
a:array[1..4] of integer;
b,i,i2,max:integer;
Begin
Readln(b);
a[1]:= b div 1000;
a[2]:= b div 100 mod 10;
a[3]:= b div 10 mod 10;
a[4]:= b mod 10;
max:=1;
for i2:=1 to 4 do begin
for i:=1 to 4 do if a[max]<a[i] then max:=i;Write(a[max]);
a[max]:=0;
End;
End