System.in.eachLine{s->(0..9).collect{-s.count("$it")}.sort().any{print(-it?:"")}println""}