using System.Text.RegularExpressions; using System.Collections.Generic; using System; public class hello { public static HashSet hs; public static string ok = "CORRECT (maybe)"; public static string ng = "WRONG!"; static void Main() { var a0 = new string[] { "digi", "petit", "gema", "piyo" }; hs = new HashSet(); foreach (var x in a0) hs.Add(x); string L; for (; (L = Console.ReadLine()) != null;) { string[] line = L.Split(' '); if (!hs.Contains(line[0])) { Console.WriteLine(ng); continue; } else { var lineL = line.Length; if (lineL == 1) { Console.WriteLine(ng); continue; } if (line[0] == "rabi") getAns0(line); else getAns(line[0], line[lineL - 1]); } } } static void getAns0(string[] line) { foreach (var x in line) { if (Regex.IsMatch(x, @"\W")) { Console.WriteLine(ok); return; } } Console.WriteLine(ng); } static void getAns(string a, string b) { if (!hs.Contains(a)) { Console.WriteLine(ng); return; } var t = b.ToLower(); bool ans; if (a == "digi") ans = Regex.IsMatch(t, @"nyo\W{0,3}$"); else if (a == "petit") ans = Regex.IsMatch(t, @"nyu\W{0,3}$"); else if (a == "gema") ans = Regex.IsMatch(t, @"gema\W{0,3}$"); else ans = Regex.IsMatch(t, @"pyo\W{0,3}$"); Console.WriteLine(ans ? ok : ng); } }