-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU import Data.Char (toLower, isAlphaNum, isSpace) import Data.List (inits, isSuffixOf) main = putStrLn . solve . map words . lines =<< getContents where solve x = unlines ans where h c | isAlphaNum c = toLower c h c | isSpace c = c h _ = '.' res True = "CORRECT (maybe)" res False = "WRONG!" digi_suffix = drop 3 $ inits "nyo..." petit_suffix = drop 3 $ inits "nyu..." gema_suffix = drop 4 $ inits "gema..." piyo_suffix = drop 3 $ inits "pyo..." g s = res . or . map (`isSuffixOf` last s) f "digi" s = g s digi_suffix f "petit" s = g s petit_suffix f "gema" s = g s gema_suffix f "piyo" s = g s piyo_suffix f "rabi" s = res $ any (any isAlphaNum) s f _ _ = res False check [] = res False check (_:[]) = res False check k = f (head k) (map (map h) $ tail k) ans = map check x