uses crt;
var s,st:string;
dem,d,i,dai,x,j,tam:integer;
a:array[1..255]of string;
b:array[1..255]of integer;
begin
clrscr;
write('nhap xau S:'); readln(s);
d:=length(s);
dem:=0;
st:='';
for i:=1 to d do
begin
if s[i] in ['A'..'z'] then
begin
s[i]:=upcase(s[i]);
st:=st+s[i];
end;
if s[i] in ['0'..'9'] then
begin
dem:=dem+1;
a[dem]:=s[i];
end;
end;
writeln('chuoi ki tu chu cai trong xau S sau khi da bien doi la: ');
dai:=length(st);
for i:=1 to dai do
write(st[i]);
writeln;
for i:=1 to dem do
val(a[i],b[i],x);
for i:=1 to dem-1 do
for j:=i+1 to dem do
if b[i]>b[j] then
begin
tam:=b[i];
b[i]:=b[j];
b[j]:=tam;
end;
writeln('chuoi ki tu chu so trong xau S sau khi da sap xep tang dan la: ');
for i:=1 to dem do
write(b[i]:4);
readln;
end.