const cf:set of char=['0'..'9'];
var
i:integer;
s:string;
begin
readln(s);
for i:=length(s) downto 1 do
if s[i] in cf then write(s[i],' ');
end.
const cf:set of char=['0'..'9'];
var
i:integer;
s:string;
begin
readln(s);
for i:=length(s) downto 1 do
if s[i] in cf then write(s[i],' ');
end.