Câu 1:
Program HOC24;
var s: string;
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#32,s)<>0 do delete(s,pos(#32#32,s),1);
write(s);
readln
end.
Câu 2:
Program HOC24;
var s: string;
d: byte;
begin
write('Nhap xau : '); readln(s);
d:=0;
for i:=1 to length(s) do if s[i]=#32 then d:=d+1;
write('Co ',d,' ki tu trang trong xau');
readln
end.
Câu 3:
Program HOC24;
var s: string;
d: byte;
begin
write('Nhap xau : '); readln(s);
d:=0;
for i:=1 to length(s) do if s[i] in ['0'..'9'] then d:=d+1;
write('Co ',d,' chu so trong xau');
readln
end.
Câu 4:
Program HOC24;
var s: string;
d: 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#32,s)<>0 do delete(s,pos(#32#32,s),1);
d:=0;
for i:=1 to length(s) do if s[i]=#32 then d:=d+1;
write('So luong cac tu trong xau la :',d+1);
readln
end.
Câu 5:
Program HOC24;
var s: string;
begin
write('Nhap xau : '); readln(s);
for i:=1 to length(s) do s[i]:=upcase(s[i]);
write('Xau sau khi in hoa : ',s);
readln
end.
Câu 6:
Program HOC24;
var s: string;
n,i: integer;
a: array[1..32000] of string;
function chuyen(x: string): string;
begin
x[1]:=upcase(x[1]);
chuyen:=x;
end;
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#32,s)<>0 do delete(s,pos(#32#32,s),1);
writeln('Xau sau khi xoa dau cach : ',s);
s:=s+' ';
while length(s)<>0 do
begin
st:=copy(s,1,pos(' ',s)-1);
n:=n+1;
a[n]:=st;
delete(s,1,pos(' ',s));
end;
for i:=1 to n do write(chuyen(a[i]),' ');
readln
end.