uses crt;
var s,st,st1:string;
d,i,vt,dem:integer;
a:array[1..255]of integer;
begin
clrscr;
write('nhap xau S:'); readln(s);
d:=length(s);
st:='';
for i:=1 to d do
if s[i] in ['0'..'9'] then st:=st+s[i];
writeln('Xau moi vua duoc tao la: ',st);
write('Xau ',s,' sau khi xoa cac ki tu a va b la:');
for i:=1 to d do
if (s[i]<>'a') and (s[i]<>'b') then write(s[i]);
writeln;
st1:='tin';
vt:=pos(st1,s);
if vt=0 then writeln(s)
else
begin
inc(dem);
a[dem]:=vt;
end;
if dem>0 then
begin
for i:=1 to dem do
begin
delete(s,a[i],3);
insert('tin hoc',s,a[i]);
end;
writeln(s);
end;
readln;
end.