import Data.Char (isPunctuation)

extractWords :: String -> [String]
extractWords =
    filter (\s -> let l = length s in 3 <= l && l <= 6) . words . filter isNotCommaPeriod
    where isNotCommaPeriod c = (c /= '.') && (c /= ',')

main :: IO ()
main = putStrLn . unwords . extractWords =<< getLine