#include #include #include using namespace std; int main(void) { string hands[] = { "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR", "NO HAND" }; int a[5]; for(int i = 0; i < 5; i++) cin >> a[i]; sort(a, a + 5); map freq; for(int i = 0; i < 5; i++) { freq[a[i]]++; } int pairs = 0, triples = 0; for(auto& f : freq) { if(f.second == 3) triples++; else if(f.second == 2) pairs++; } if(triples == 1 && pairs == 1) { cout << hands[0]; } else if(triples == 1) { cout << hands[1]; } else if(pairs == 2) { cout << hands[2]; } else if(pairs == 1) { cout << hands[3]; } else { cout << hands[4]; } }