Created
April 20, 2016 10:29
-
-
Save yudetamago/520d18a90597618b06ff9e3f1b417b9e to your computer and use it in GitHub Desktop.
指定した位置に'"'を入れる
This file contains 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 | |
import Data.List | |
main = do | |
s <- getLine | |
ind <- (map read . words) <$> getLine | |
putStrLn $ solve s ind | |
solve :: String -> [Int] -> String | |
solve s ind = init $ concatMap insert_double_quote (zip [0..] (s ++ "_")) | |
where insert_double_quote p = (if elem (fst p) ind then ['\"'] else []) ++ [snd p] | |
{- | |
waaai | |
0 2 5 | |
=> | |
"wa"aai" | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment