g={"0"=>20104,"1"=>20063,"2"=>19892,"3"=>20011,"4"=>19874,"5"=>20199,"6"=>19898,"7"=>20163,"8"=>19956,"9"=>19841} h=Hash.new(0);gets.chomp.each_char{|c|h[c]+=1} puts ('0'..'9').minmax_by{|i|g[i]-h[i]}*' '