#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; bool prefix_check(const string& prefix, const string& str){ if(prefix.size() > str.size()) return false; rep(i,prefix.size()){ if(str[i]!=prefix[i]) return false; } return true; } bool is_symbol(char c){ if((' '<=c && c<='/') || (':'<=c && c<='@') || ('['<=c && c<='`') || ('{'<=c && c<='~')){ return true; } return false; } bool suffix_check(int st, const string& suffix, const string& str){ if(str.size()-st < suffix.size()) return false; if(str.size()-suffix.size()>=st){ bool flg = true; rep(i,suffix.size()){ int offset = str.size()-suffix.size(); if(suffix[i] != str[offset+i]) flg = false; } if(flg) return true; } if(str.size()-suffix.size()-1>=st){ bool flg = true; rep(i,suffix.size()){ int offset = str.size()-suffix.size()-1; if(suffix[i] != str[offset+i]) flg = false; } if(!is_symbol(str[str.size()-1])) flg = false; if(flg) return true; } if(str.size()-suffix.size()-2>=st){ bool flg = true; rep(i,suffix.size()){ int offset = str.size()-suffix.size()-2; if(suffix[i] != str[offset+i]) flg = false; } if(!is_symbol(str[str.size()-1])) flg = false; if(!is_symbol(str[str.size()-2])) flg = false; if(flg) return true; } if(str.size()-suffix.size()-3>=st){ bool flg = true; rep(i,suffix.size()){ int offset = str.size()-suffix.size()-3; if(suffix[i] != str[offset+i]) flg = false; } if(!is_symbol(str[str.size()-1])) flg = false; if(!is_symbol(str[str.size()-2])) flg = false; if(!is_symbol(str[str.size()-3])) flg = false; if(flg) return true; } return false; } bool include_char(int st, const string& str){ REP(i,st,str.size()){ if(is_symbol(str[i])) return true; } return false; } int main(){ string str; while(getline(cin, str)){ bool flg = false; if(prefix_check("digi ", str)){ string foo = str; std::transform(foo.begin(), foo.end(), foo.begin(), ::tolower); if(suffix_check(4, "nyo", foo)) flg = true; } else if(prefix_check("petit ", str)){ string foo = str; std::transform(foo.begin(), foo.end(), foo.begin(), ::tolower); if(suffix_check(5, "nyu", foo)) flg = true; } else if(prefix_check("rabi ", str)){ string foo = str; std::transform(foo.begin(), foo.end(), foo.begin(), ::tolower); if(include_char(4, foo)) flg = true; } else if(prefix_check("gema ", str)){ string foo = str; std::transform(foo.begin(), foo.end(), foo.begin(), ::tolower); if(suffix_check(4, "gema", foo)) flg = true; } else if(prefix_check("piyo ", str)){ string foo = str; std::transform(foo.begin(), foo.end(), foo.begin(), ::tolower); if(suffix_check(4, "pyo", foo)) flg = true; } if(flg){ cout << "CORRECT (maybe)" << endl; }else{ cout << "WRONG!" << endl; } } return 0; }