uses crt;
var a:string;
d,i,dem:integer;
begin
clrscr;
write('nhap xau a:'); readln(a);
d:=length(a);
dem:=0;
for i:=1 to d do
if a[i]=' ' then inc(dem);
writeln('so luong dau cach co trong xau a la:',dem);
readln;
end.
program so_luong_chu_A;
uses crt;
var
st:string;
i,dem:integer;
begin
clrscr;
writeln('Moi nhap xau :',st); readln(st);
dem:=0;
for i:=1 to length(st) do
begin
if (st[i]='A') then inc(dem);
end;
writeln(dem);
for i:=1 to dem do write('A');
readln;
end.
#Học tốt!