uses
Crt;
const
sg = ['b', 'c', 'd'];
var
s: string;
i: integer;
begin
ClrScr;
ReadLn(s);
for i := Length(s) downto 1 do
if s[i] in sg then
Insert(s[i], s, i)
else
if s[i] = ' ' then
Delete(s, i, 1);
WriteLn(s);
ReadLn;
end.