main = do
  s <- getLine
  putStrLn $ unwords [j |j <- (cut [[]] s),length j >= 3, length j <= 6]

cut :: [String] -> String -> [String]
cut l [] = l
cut l (' ':xs) = cut (l ++ [[]]) xs
cut l (',':xs) = cut (l ++ [[]]) xs
cut l ('.':xs) = cut (l ++ [[]]) xs
cut l (x:xs) = cut (append l x) xs

append :: [String] -> Char -> [String]
append l c  = init l ++ ((last l ++ (c:[])):[])