f = {"0"=>20104, "1"=>20063, "2"=>19892, "3"=>20010, "4"=>19874, "5"=>20199, "6"=>19898, "7"=>20163, "8"=>19956, "9"=>19841} h = (0..9).map {|v| [v.to_s, 0]}.to_h t = STDIN.gets.chomp[2..-1] t.chars.each {|v| h[v]+=1} p f.keys.find {|k| f[k] == t[k] } || 3