#include #include #include using namespace std; #define DIM 100 char sir[DIM]; int validcarac(char c) { if('A' <= c && c <= 'Z') { return 1; } if('0' <= c && c <= '9') { return 1; } return (c == ' '); } int main() { #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); #endif // ONLINE_JUDGE int N; cin >> N; while(N--) { cin.get(); cin.get(sir, 100); int lg = strlen(sir); int okey = 0; for(int i = 0; i < lg; ++i) { if(validcarac(sir[i]) == 0) { okey = 1; break; } } if(sir[0] != 'B' && sir[1] == ' ') { okey = 1; } int pos = 0; int a = 0, b = 0, c = 0; int spatiu1 = 0, spatiu2 = 0; while(pos < lg && sir[pos] != ' ') { if('0' <= sir[pos] && sir[pos] <= '9') { okey = 1; } ++pos; ++a; } while(pos < lg && sir[pos] == ' ') { ++pos; ++spatiu1; } while(pos < lg && sir[pos] != ' ') { if('A' <= sir[pos] && sir[pos] <= 'Z') { okey = 1; } ++b; ++pos; } while(pos < lg && sir[pos] == ' ') { ++pos; ++spatiu2; } while(pos < lg) { if('0' <= sir[pos] && sir[pos] <= '9') { okey = 1; } ++pos; ++c; } if(spatiu1 != 1 || spatiu2 != 1) { okey = 1; } if(c != 3) { okey = 1; } if(b != 2 && b != 3) { okey = 1; } if(a > 2 || a < 1) { okey = 1; } if(okey == 1) { cout << "Incorrect!\n"; } else { cout << "Correct!\n"; } } return 0; }