> import qualified Char > words' :: String -> [String] > words' [] = [] > words' (x:xs) > | Char.isSpace x = words1 xs > | otherwise = case words' xs of > [] -> [[x]] > (ys:yss) -> (x:ys):yss > where > words1 [] = [] > words1 xs@(y:ys) | Char.isSpace y = words1 ys > | otherwise = [] : words' xs > main = interact (unwords . words')