using System; using System.Linq; using System.Collections.Generic; class Program { static void Main() { var getCard = Console.ReadLine().Split().Select(int.Parse).ToList(); // 配役判定用インスタンス生成 var check = new CastingCards(); // 配役数判定 var tmp = check.RoleDuplicate(getCard); //Console.WriteLine(tmp.Count); if (tmp.Count == 0) { Console.WriteLine("NO HAND"); } else { // 配役取得 if (tmp.Count > 1) { var role = string.Join(":", tmp); var ans = role switch { "3:2" => "FULL HOUSE", "2:3" => "FULL HOUSE", "2:2" => "TWO PAIR", "3" => "THREE CARD", "2" => "TWO PAIR", "1" => "ONE PAIR", "5" => "NO HAND", "4" => "NO HAND" }; Console.WriteLine(ans); } else { var role = tmp[0]; var ans = role switch { 3 => "THREE CARD", 2 => "TWO PAIR", 1 => "ONE PAIR", 5 => "NO HAND", 4 => "NO HAND" }; Console.WriteLine(ans); } } } } class CastingCards { // 役判定(重複数の取得) public List? RoleDuplicate(List cards) { var duplicates = cards.GroupBy(x => x) .Where(x => x.Count() > 1) .ToDictionary(x => x.Key, y => y.Count()); //Console.WriteLine(string.Join(":", duplicates)); // Dictionary型をList型に変換 List valsList = duplicates.Values.ToList(); //Console.WriteLine(valsList.Count); //Console.WriteLine(valsList[0]); return valsList; } }