/////////////////////////No.227 簡単ポーカー //入力文字読み取り process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (chunk) { //一文字ずつを配列に格納 var cards = chunk.split(" "); //カードをソート cards.sort(function (a, b) { if (a < b) return -1; if (a > b) return 1; return 0; }); //カードの役を入れる var winninghands = "NO HAND"; //同じカードが三枚あるか for (var i = 0; i < cards.length-2; i++) { if (cards[i] == cards[i + 1] && cards[i] == cards[i + 2]) { if (cards[i] == cards[i + 3]) { //フォーカード、ファイブカード winninghands = "NO HAND"; break; } else { cards.splice(i, 3); if (cards[0] == cards[1]) { winninghands = "FULL HOUSE" } else if (cards[0] != cards[1]) { winninghands = "THREE CARD" } } } } //同じカードが二枚あるか if (winninghands == "NO HAND") { for (var i = 0; i < cards.length - 2; i++) { if (cards[i] == cards[i + 2]) { //フォーカード、ファイブカード break; } else { if (cards[i] == cards[i + 1]) { cards.splice(i, 2); if (cards[0] == cards[1] || cards[1] == cards[2]) { winninghands = "TWO PAIR" } else { winninghands = "ONE PAIR" } } } } } console.log(winninghands) });