#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU # 解説読後 # http://yukicoder.me/problems/686/editorial s = gets.chomp a = Hash.new 0 s.each_char do |c| a[c] += 1 end b = [20106, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841] w = '' c = '' a.each do |k,v| case b[k.to_i] <=> v when 1 c = k when -1 w = k end end puts w + ' ' + c