gets numbers = gets.split.map(&:to_i) hash = Hash.new(0) numbers.each do |val| hash[val] += 1 end puts hash.select { |key, val| val == 1 }.size