using System; using System.IO; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Diagnostics; using System.Numerics; using Enu = System.Linq.Enumerable; public class Program { static readonly string OK = "CORRECT (maybe)"; static readonly string NG = "WRONG!"; static readonly string[] Characters = { "digi", "petit", "rabi", "gema", "piyo" }; Regex[] reg; bool[] isK; string K; public void Solve() { K = ""; isK = new bool[256]; for (char c = (char)32; c < 127; c++) if (!char.IsDigit(c) && !char.IsLetter(c)) { K += c; isK[c] = true; } reg = new Regex[Characters.Length]; reg[0] = new Regex("nyo[" + K + "?]{0,3}$"); reg[1] = new Regex("nyu[" + K + "?]{0,3}$"); reg[3] = new Regex("gema[" + K + "?]{0,3}$"); reg[4] = new Regex("pyo[" + K + "?]{0,3}$"); string S; while (!string.IsNullOrEmpty(S = Console.ReadLine())) { int who = 0; for (; who < Characters.Length; who++) if (S.StartsWith(Characters[who])) { string sub = S.Substring(Characters[who].Length + 1).ToLower(); Console.WriteLine(Valid(sub, who) ? OK : NG); break; } if (who == Characters.Length) Console.WriteLine(NG); } } private bool Valid(string S, int who) { if (who == 2) { int count = 0; foreach (char c in S) if (isK[c] && ++count > 1) return false; return count == 1; } return reg[who].IsMatch(S); } } class Entry { static void Main() { new Program().Solve(); } } class Reader { static TextReader reader = Console.In; static readonly char[] separator = { ' ' }; static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries; static string[] A = new string[0]; static int i; static void Init() { A = new string[0]; } public static void Set(TextReader r) { reader = r; Init(); } public static void Set(string file) { reader = new StreamReader(file); Init(); } public static bool HasNext() { return CheckNext(); } public static string String() { return Next(); } public static int Int() { return int.Parse(Next()); } public static long Long() { return long.Parse(Next()); } public static double Double() { return double.Parse(Next()); } public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); } public static int[] IntArray(int N) { return Range(N, Int); } public static int[][] IntTable(int H) { return Range(H, IntLine); } public static string[] StringArray(int N) { return Range(N, Next); } public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); } public static string Line() { return reader.ReadLine().Trim(); } static T[] Range(int N, Func f) { return Enu.Range(0, N).Select(i => f()).ToArray(); } static string[] Split(string s) { return s.Split(separator, op); } static string Next() { CheckNext(); return A[i++]; } static bool CheckNext() { if (i < A.Length) return true; string line = reader.ReadLine(); if (line == null) return false; if (line == "") return CheckNext(); A = Split(line); i = 0; return true; } }