main :: IO () main = readLn >>= putStrLn . palDecomp ['a'..'z'] palDecomp :: [Char] -> Int -> String palDecomp (c:cs) 1 = [c] palDecomp (c:cs) n | even n = [c] ++ palDecomp cs (n-1) ++ [c] | otherwise = [c] ++ palDecomp (c:cs) (div (n-1) 2 + 1) ++ [c]