procedure Gnat.Io.A is M,D:Character;procedure R(A:string)is begin Get(D);If D>'~'Then Put(A);elsif D=M then R(D&A);elsif D>m then R(A&D);else Put(D);R(A);end if;end;begin Get(M);R(M&"");end;