module Main where type Input = (String, Int, Char) type Output = String parse :: String -> Input parse str = let s = (!!1) . lines $ str [x, c] = words . (!!2) . lines $ str in (s, read x, head c) solve :: Input -> Output solve (s, x, c) = let f i v | i == x = c | otherwise = v in [ f i v | (v, i) <- zip s [1..] ] render :: Output -> String render = id main :: IO () main = interact ( render . solve . parse )