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