uses crt;
var s:string;
d,i,dem:integer;
begin
clrscr;
write('Nhap xau S:'); readln(s);
d:=length(s);
dem:=0;
for i:=1 to d do
if s[i]='h' then inc(dem);
writeln('Trong xau ',s,' co ',dem,' ki tu h');
while s[1]=' ' do
delete(s,1,1);
writeln('Xau sau khi xoa cac ki tu dau la: ',s);
while s[d]=' ' do
delete(s,d,1);
for i:=d downto 1 do
if (s[i]=' ') and (s[i-1]=' ') then delete(s,i,1);
for i:=1 to d do
if s[i] in ['A'..'Z'] then s[i]:=chr(ord(s[i])+32);
for i:=1 to d do
s[1]:=upcase(s[1]);
for i:=1 to d do
if (s[i]=' ') then s[i+1]:=upcase(s[i+1]);
writeln('Xau sau khi chuan hoa la: ',s);
readln;
end.