#include #include #include #include #include using namespace std; bool capLet(char c) { return c >= 'A' && c <= 'Z'; } bool solve() { string s; string a, b, c; getline(cin, s); istringstream fin(s); fin >> a >> b >> c; if(a.size() + b.size() + c.size() + 2 != s.size()) { return false; } if(a.size() == 1) { if(a[0] != 'B') { return false; } if(b.size() < 2 || b.size() > 3) { return false; } } else if(a.size() == 2) { if(!capLet(a[0]) || !capLet(a[1])) { return false; } if(b.size() != 2) { return false; } } else { return false; } for(int i = 0; i < b.size(); i++) { if(b[i] < '0' || b[i] > '9') { return false; } } if(c.size() != 3) { return false; } if(!capLet(c[0]) || !capLet(c[1]) || !capLet(c[2])) { return false; } return true; } int main() { int t; cin >> t; string s; getline(cin, s); for(; t; t--) { if(solve()) { cout << "Correct!\n"; } else { cout << "Incorrect!\n"; } } return 0; }