#include #include #include #include using namespace std; int main (int argc, char * argv[]) { string a; int rok = 0, mesic = 0, den=0, k = 0;//, konec = 0; while (1) { cin >> a; if ( a == "end" ) break; if (a.length() < 10){ cout << "invalid" << endl; } else if (a[6] != '/'){ cout << "invalid" << endl; }else { char b[2]; b[0] = a[0] ; b[1] = a[1] ; rok = atoi(b); b[0] = a[2] ; b[1] = a[3] ; mesic = atoi(b); b[0] = a[4] ; b[1] = a[5] ; den = atoi(b); if (rok > 9 && rok < 20){ cout << "invalid" << endl; } else if (rok > 9 && rok <= 53 && a.length() > 10){ cout << "invalid" << endl; } else if ((rok % 4 != 0 && rok != 0 ) && (mesic == 2 || mesic == 52) && den > 28){ cout << "invalid" << endl; } else if (a[10] == '\0'){ char pom[3]; pom[0] = a[8] ; pom[1] = a[9] ; pom[2] = '\0'; k = atoi(pom); //cout << "k " << k << endl; pom[0] = a[5] ; pom[1] = a[7] ; pom[2] = '\0'; k += atoi(pom); //cout << "k " << k << endl; pom[0] = a[3] ; pom[1] = a[4] ; pom[2] = '\0'; k += atoi(pom); //cout << "k " << k << endl; pom[0] = a[1] ; pom[1] = a[2] ; pom[2] = '\0'; k += atoi(pom); //cout << "k " << k << endl; pom[0] = '0' ; pom[1] = a[0] ; pom[2] = '\0'; k += atoi(pom); //cout << "k " << k << " mod " << (k % 11) << endl; //char pom[3]; pom[0] = a[7] ; pom[1] = a[8] ; pom[2] = '\0'; int l = atoi(pom); char pom2[3]; pom2[0] = a[9] ; pom2[1] = a[10]; pom2[2] = '\0'; int d = atoi(pom2); //cout << "l " << l << " d " << d << " soucet " << (den + mesic + rok + l + d) << endl; if ( (((den + mesic + rok + l + d) % 11) != 0) && ( ((k - 1) % 11) != 0 )){ cout << "invalid" << endl; } else if (mesic < 13){ cout << "boy" << endl; } else cout << "girl" << endl; /*if ( ((k - 1) % 11) != 0 ){ cout << "invalid1" << endl; } else if (mesic < 13){ cout << "boy" << endl; } else cout << "girl" << endl;*/ } else { char pom[3]; pom[0] = a[7] ; pom[1] = a[8] ; pom[2] = '\0'; int k = atoi(pom); char pom2[3]; pom2[0] = a[9] ; pom2[1] = a[10]; pom2[2] = '\0'; int d = atoi(pom2); //cout << "k " << k << " d " << d << " soucet " << (den + mesic + rok + k + d) << endl; if ( ((den + mesic + rok + k + d) % 11) != 0 ){ cout << "invalid" << endl; } else if (mesic < 13){ cout << "boy" << endl; } else cout << "girl" << endl; } //cout << "mudulo " << ((int)a % 11) << endl; //cout << rok << ", " << mesic << ", " << den << endl; } } //while (a[0] != 'e' && a[1] != 'n' && a[2] != 'n'); return 0; }