main :: IO () main = interact $ solve . words solve (n:xs) = foldr (++) [] xs