#include<iostream> #include<string.h> using namespace std; void fel() { int n; char s[100]; int i; cin>>n; cin.clear(); cin.sync(); for(i=0;i<n;++i) { cin.getline(s,100); if(strlen(s)!=9) { cout<<"Incorrect!\n"; cout.flush(); continue; } char *p; p=strtok(s," "); bool elso,jo=1; if(p==NULL||strlen(p)>2) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { elso=strlen(p)==1; if(elso&&p[0]!='B'){ cout<<"Incorrect!\n"; cout.flush(); jo=0; } for(int j=0;j<strlen(p)&&jo;++j) if(!((p[j]>='a'&&p[j]<='z')||(p[j]>='A'&&p[j]<='Z'))) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { p=strtok(NULL," "); if(p==NULL||strlen(p)>3||(strlen(p)==3&&!elso)) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { for(int j=0;j<strlen(p)&&jo;++j) if(!(p[j]>='0'&&p[j]<='9')) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { p=strtok(NULL," "); if(p==NULL||strlen(p)!=3) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { for(int j=0;j<strlen(p)&&jo;++j) if(!((p[j]>='a'&&p[j]<='z')||(p[j]>='A'&&p[j]<='Z'))) { cout<<"Incorrect!\n"; cout.flush(); jo=0; } if(jo) { cout<<"Correct!\n"; cout.flush(); jo=0; } } } } } } } } int main() { fel(); return 0; }