cs = Hash.new(0) gets.split.map(&:to_i).each do |a| cs[a] += 1 end c3 = cs.count { |k,v| v == 3 } c2 = cs.count { |k,v| v == 2 } if c3 == 1 && c2 == 1 puts 'FULL HOUSE' elsif c3 == 1 puts 'THREE CARD' elsif c2 == 2 puts 'TWO PAIR' elsif c1 == 1 puts 'ONE PAIR' else puts 'NO HAND' end