-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU import Data.Char (toLower, isAlphaNum, isSpace) import Data.List (inits, isSuffixOf) main = putStrLn . solve . 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` 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 isAlphaNum s f _ _ = res False check ([], _) = res False check (_, []) = res False check (n, t) = f n (map h t) precheck = check . span (/= ' ') ans = map precheck x