cards = gets.split.map(&:to_i) hand = [] while (!cards.empty?) hand << cards.count(cards[0]) cards.delete(cards[0]) end hand.sort!.reverse! case hand[0] when 3 if hand[1] == 2 puts "FULL HOUSE" else puts "THREE CARD" end when 2 if hand.length == 3 puts "TWO PAIR" else puts "ONE PAIR" end else puts "NO HAND" end