uses crt;
var st1,st2:string;
b:array[1..10]of integer;
i,a,dem,d1,d2:integer;
begin
clrscr;
for i:=1 to 10 do
begin
write('Nhap so thu ',i,'='); readln(b[i]);
end;
write('Nhap xau thu nhat:'); readln(st1);
write('Nhap xau thu hai:'); readln(st2);
writeln('Cac so nguyen co gia tri lon hon 20 va nho hon 50 la: ');
for i:=1 to 10 do
if (b[i]>20) and (b[i]<50) then write(b[i]:4);
writeln;
write('Nhap a='); readln(a);
dem:=0;
for i:=1 to 10 do
if b[i]>a then inc(dem);
writeln('So phan tu lon hon ',a,' trong day la: ',dem);
d1:=length(st1);
d2:=length(st2);
if d1>d2 then writeln('Xau ',st1,' dai hon xau ',st2,' va dai hon ',d1-d2,' ki tu');
if d1=d2 then writeln('Hai xau co do dai bang nhau');
if d1<d2 then writeln('Xau ',st2,' dai hon xau ',st1,' va dai hon ',d2-d1,' ki tu');
if d2>8 then
begin
if (st2[d2-1] in ['0'..'9']) and (st2[d2] in ['0'..'9']) then
begin
st2[d2-1]:='a';
st2[d2]:='b';
delete(st2,d2-1,2);
end
else delete(st2,d2-1,2);
writeln(st2);
end
else writeln('Xau ',st2,' khong dai hon 8 ki tu');
readln;
end.