using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string abc = "abcdefghijklmnopqrstuvwxyz"; static void Main() { Scanner sc = new Scanner(); while (true) { string name = sc.Next(); string speak = ToSmall(sc.NextLine()); bool a = false; switch (name) { case "digi": a = last(speak, "nyo"); break; case "petit": a = last(speak, "nyu"); break; case "rabi": foreach(char c in abc) { if (speak.Contains(c)) { a = true; break; } } a = false; break; case "gema": a = last(speak, "gema"); break; case "piyo": a = last(speak, "pyo"); break; } if (a) { Console.WriteLine("CORRECT (maybe)"); } else { Console.WriteLine("WRONG!"); } } } static bool last(string S,string last) { int ind = 0; if (S.Length < 3) { return false; } for(int i = 1; i <= 3; i++) { if( abc.Contains(S[S.Length - i])) { break; } ind++; } if (S.Length - ind < last.Length) { return false; } for(int i = 0; i < last.Length; i++) { if (S[S.Length - 1 - ind - i] != last[last.Length - i - 1]) { return false; } } return true; } static string ToSmall(string S) { char[] C = S.ToArray(); for(int i = 0; i < C.Length; i++) { int ind = ABC.IndexOf(C[i]); if (ind >= 0) { C[i] = abc[ind]; } } return new string(C); } } public class Scanner { public string[] S; private int Index; private char Separator; public Scanner(char separator=' ') { Index = 0; Separator = separator; } public string Next() { string result; if (S == null || Index >= S.Length) { S = Line(); Index = 0; } result = S[Index]; Index++; return result; } public string NextLine() { if (Index >= S.Length) { S = Line(); Index = 0; } List res = new List(); for(int i = Index; i < S.Length; i++) { res.Add(S[i]); } Index = S.Length; return string.Join(Separator.ToString(), res.ToArray()); } private string[] Line() { return Console.ReadLine().Split(Separator); } public int NextInt() { return int.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } }