arr = gets.chomp.split.map(&:to_i).group_by { |e| e }.values.sort_by { |e| e.length } puts 'NO HAND' if arr.length == 5 || arr.length == 1 puts 'ONE PAIR' if arr.length == 4 if arr.length == 3 puts 'TWO PAIR' if arr[2].length == 2 puts 'THREE CARD' if arr[2].length == 3 end if arr.length == 4 puts 'FULL HOUSE' if arr[1].length == 3 puts 'NO HAND' if arr[1].length == 4 end