• + 0 comments

    A simple haskell solution:

    import Control.Monad
    
    merge (x:y:rest) = y:x: merge rest
    merge rest = rest
    
    main = do
        count <- getLine
        forM [0..(read count :: Int)-1] $
            (\_ -> do -- Here's where the magic happens N times:
                line <- getLine
                putStrLn $ merge line
            )