for each(n in readline(s="0123456789"))putstr(s.indexOf(n)),s=n+s.replace(n,'')