#include using namespace std; bool check(char* s, int x) { if (s[x] == NULL) return true; return false; } int main() { int n; cin >> n; cin.get(); char s[30]; for (int i = 0; i < n; ++i) { cin.getline(s, 30); int x; if (s[0] == 'B' && s[1] == ' ') { if (isdigit(s[2]) && isdigit(s[3])) { if (isdigit(s[4]) && s[5] == ' ') x = 6; else if (s[4] == ' ') x = 5; } else {cout << "Incorrect!\n"; continue;} if (isupper(s[x]) && isupper(s[x+1]) && isupper(s[x+2]) && check(s, x+3)) {cout << "Correct!\n"; continue;} else {cout << "Incorrect!\n"; continue;} } else { if (isupper(s[0]) && isupper(s[1]) && s[2] == ' ') { if (isdigit(s[3]) && isdigit(s[4])) { if (s[5] == ' ') x = 6; else {cout << "Incorrect!\n"; continue;} } else {cout << "Incorrect!\n"; continue;} if (isupper(s[x]) && isupper(s[x+1]) && isupper(s[x+2]) && check(s, x+3)) {cout << "Correct!\n"; continue;} else {cout << "Incorrect!\n"; continue;} } else {cout << "Incorrect!\n"; continue;} } } return 0; }