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.