Skip to content

Instantly share code, notes, and snippets.

@yudetamago
Created April 20, 2016 10:29
Show Gist options
  • Save yudetamago/520d18a90597618b06ff9e3f1b417b9e to your computer and use it in GitHub Desktop.
Save yudetamago/520d18a90597618b06ff9e3f1b417b9e to your computer and use it in GitHub Desktop.
指定した位置に'"'を入れる
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