#include using namespace std; #define int long long #define NO { cout << "WRONG!\n"; continue; } #define YES { cout << "CORRECT (maybe)\n"; continue; } bool is_symbol(char c) { return !isdigit(c) && !isalpha(c); } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); // mapping from character name to lowercase ?root? suffix map mp = { {"digi", "nyo"}, {"petit", "nyu"}, {"gema", "gema"}, {"piyo", "pyo"} }; string line; while (getline(cin, line) && !line.empty()) { // split on the *first* space auto pos = line.find(' '); if (pos == string::npos) NO string name = line.substr(0, pos); string s = line.substr(pos + 1); if (name == "rabi") { // must contain at least one non-symbol bool ok = false; for (char c : s) { if (!is_symbol(c)) { ok = true; break; } } if (ok) YES else NO } else { // peel off up to 3 trailing symbols int cnt = 0; while (!s.empty() && is_symbol(s.back())) { cnt++; s.pop_back(); } if (cnt > 3) NO auto it = mp.find(name); if (it == mp.end()) NO // case?insensitive compare for the root suffix string root = it->second; for (char &c : s) c = tolower(c); if (s.size() >= root.size() && s.substr(s.size() - root.size()) == root) { YES } else { NO } } } return 0; }