main = getLine >>= putStrLn . unwords . filter isWord . splitBy isPunc
 where isWord s = elem (length s) [3..6]; isPunc c = elem c " .,"

splitBy p xs
 | null xs = []
 | p (head xs) = splitBy p (tail xs)
 | otherwise = (takeWhile (not.p) xs : splitBy p (dropWhile (not.p) xs))