counts = Array.new(13, 0) hands = gets.split.map(&:to_i) hands.each do |n| counts[n-1] += 1 end counts = counts.sort.delete_if(&:zero?) case counts when [2, 3] puts 'HULL HOUSE' when [1, 1, 3] puts 'THREE CARD' when [1, 2, 2] puts 'TWO PAIR' when [1, 1, 1, 2] puts 'ONE PAIR' else puts 'NO HAND' end