splitBy p xs | null xs = [] | p (head xs) = splitBy p (tail xs) | otherwise = (takeWhile (not.p) xs : splitBy p (dropWhile (not.p) xs)) main = do str <- dropWhile (=='w') <$> getLine let maxl = maximum $ map length (splitBy (/='w') str) let sws = zip (splitBy (=='w') str) (splitBy (/='w') str) putStrLn $ unlines $ map fst $ filter ((== maxl) . length . snd) sws