#include #include #include #include //#include //#include using namespace std; bool isnum(char ch) {return ch >='0' && ch<='9';} #define JE_STARY_FORMAT(x) (x[10]=='\0') bool delitelne_jedenacti(string str) { int r; if(JE_STARY_FORMAT(str)) return true; else r = (str[0]-'0')-(str[1]-'0')+(str[2]-'0')-(str[3]-'0')+(str[4]-'0')-(str[5]-'0')+(str[7]-'0')-(str[8]-'0')+(str[9]-'0')-(str[10]-'0'); if(r<0) r=-r; return ((r%11) == 0 ); }; int main() { //int ch; //int stav=0; //char vstup[5]; //char* line = new char[100]; string line; char mm[] = "MM"; char yy[] = "YY"; char dd[] = "DD"; //char cele10[] = "0123456789"; //char cele9[] = "012345678"; while(getline(cin,line)) { if(line[0]=='e' && line[1]=='n' && line[2]=='d' && (line[3]=='\0' || line[3]=='\r' || line[3]=='\n')) break; if(isnum(line[0])&&isnum(line[1])&&isnum(line[2])&&isnum(line[3])&&isnum(line[4])&&isnum(line[5])&& line[6]=='/'&& isnum(line[7])&&isnum(line[8])&&isnum(line[9])&& ( (isnum(line[10])&&line[11]=='\0') || (line[10]=='\0') ) ) { if(!delitelne_jedenacti(line)) { cout << "invalid" << endl; ////<<1<19 && yyi < 54) { if(!JE_STARY_FORMAT(line)) { cout << "invalid" << endl; //<<2< 53) { if(JE_STARY_FORMAT(line)) { cout << "invalid" << endl; //<<3<0&&ddi<=mlimit[mmii]) { if(yyi%4!=0 && mmii==2 && ddi==29) { cout << "invalid" << endl; //<<5<=1 && (mmi%50)<=12) { if((mmi<50)) cout<<"boy"<