mystr (x:xs) = if null xs then x else x++" "++(mystr xs)

main = do
    str <- getContents
    putStrLn $ mystr $ filter (\x->3<=(length x)&&(length x)<=6) $ words $ map (\x->if x=='.'||x==',' then ' ' else x) str