Created
October 9, 2018 01:45
-
-
Save wuerges/66b2b3a6c3c5fed4ab5ba48b333d61a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Applicative | |
import Control.Monad | |
fixLine [] = Nothing | |
fixLine (l:ls) = case l of | |
['O','O', _ , _ , _ ] -> Just $ ("++"++ drop 2 l) : ls | |
[ _ , _ , _ ,'O','O'] -> Just $ (take 3 l ++"++") : ls | |
_ -> (l:) <$> (fixLine ls) | |
main = do | |
n <- read <$> getLine | |
lines <- replicateM n getLine | |
case fixLine lines of | |
Just x -> do putStrLn "YES" | |
mapM_ putStrLn x | |
Nothing -> putStrLn "NO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment