NUMBER_OF_QUESTIONS = gets.to_i number_array = [] (0..9).each do |i| number_array[i] = 0 end NUMBER_OF_QUESTIONS.times do get_string = gets numbers = get_string[0, 7].split.map(&:to_i).to_a inside_answer = get_string.split.last == 'YES' ? 1 : -1 numbers.each do |number| number_array[number] += inside_answer end end puts number_array.index(number_array.max_by { |num| num })