#include #include using namespace std; #define rep(i,n) for(int i = 0; i < n; i++) int main(void){ // Your code here! string s[] = { "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR" }; int a[5]; int p1 = 0,p2 = 0; for(int i = 0; i < 5; i++) cin >> a[i]; sort(a,a + 5); int b = 0,c = 0; rep(i,5){ if(i == 0){ b = a[i]; c = 1; } else { if(b == a[i]) { c++; } else { if(p1 >= p2){ if(p2 < c)p2 = c; } else { if(p1 < c)p1 = c; } c = 1; b = a[i]; } } } if(p1 == 0)p1 = c; if(p2 == 0)p2 = c; bool two = false, thr = false; if(p1 >= 2 || p2 >= 2) { if(p1 == 2 || p2 == 2)two = true; if(p1 == 3 || p2 == 3)thr = true; if(two && thr)cout << "FULL HOUSE"; else if(p1 == 2 && p2 == 2)cout << "TWO PAIR"; else if(thr)cout << "THREE CARD"; else if(two)cout << "ONE PAIR"; else cout << "NO HAND"; } else { cout << "NO HAND"; } }