hands = gets.split.map(&:to_i) hash = Hash.new(0) hands.each do |val| hash[val] += 1 end if hash.values.max == 3 if hash.values.include?(2) puts 'FULL HOUSE' else puts 'THREE CARD' end elsif hash.values.max == 2 if hash.values.count(2) == 2 puts 'TWO PAIR' else puts 'ONE PAIR' end else puts 'NO HAND' end