1.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
for i:=length(s) downto 1 do write(upcase(s[i]));
readln
end.
1:
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
write('Dang dao nguoc cua xau la: ');
for i:=d downto 1 do
write(st[i]);
writeln;
for i:=1 to d do
st[i]:=upcase(st[i]);
write('Xau duoi dang in hoa la: ',st);
readln;
end.
2:
uses crt;
var st:string;
i,d:integer;
begin
clrscr;
write('Nhap xau:'); readln(st);
d:=length(st);
i:=pos('anh',st);
while i<>0 do
begin
delete(st,i,3);
insert('em',st,i);
i:=pos('anh',st);
end;
while st[1]=#32 do
begin
delete(st,1,1);
d:=length(st);
end;
while st[d]=#32 do
begin
delete(st,d,1);
d:=length(st);
end;
for i:=1 to d do
while (st[i]=#32) and (st[i+1]=#32) do
begin
delete(st,i,1);
d:=length(st);
end;
writeln('Xau sau khi xu ly la: ',st);
readln;
end.
2.
Program HOC24;
var s: string;
i: byte;
begin
write('Nhap xau : '); readln(s);
while s[1]=#32 do delete(s,1,1);
while s[length(s)]=#32 do delete(s,length(s),1);
while pos(#32,s)<>0 do delete(s,pos(#32,s),1);
while pos('anh',s)<>0 do
begin
insert('em',s,pos('anh',s));
delete(s,pos('anh',s),3);
end;
write(s);
readln
end.