import math._ object Main { def calc(xs: Array[Int]): String = { var ar = new Array[Int](14) for (x <- xs) ar(x) += 1 var tri = 0 var pair = 0 for (x <- ar) x match { case 2 => pair += 1 case 3 => tri += 1 case _ => 0 } if (tri == 1 && pair == 1) return "FULL HOUSE" if (tri == 1) return "THREE CARD" if (pair == 2) return "TWO PAIR" if (pair == 1) return "ONE PAIR" return "NO HAND" } def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val xs = (1 to 5).map { e => sc.nextInt }.sorted.toArray println(calc(xs)) } }