var f,g:string;
i:integer;
begin
readln(f);
for i:=1 to length(f)-1 do if (f[i+1]='а') then g:=g+f[i];
writeln(g);
g:='';
for i:=2 to length(f) do if (f[i-1]='а') then g:=g+f[i];
end.
var f,g:string;
i:integer;
begin
readln(f);
for i:=1 to length(f)-1 do if (f[i+1]='а') then g:=g+f[i];
writeln(g);
g:='';
for i:=2 to length(f) do if (f[i-1]='а') then g:=g+f[i];
writeln(g);
end.