keys = [] 3.times { keys << gets.chomp } puts keys.inject(Hash.new(0)) {|hash, k| hash[k] += 1;hash}.sort.reverse[0][0]