object Main extends App {
  val str = io.Source.stdin.getLines.next
  println(str.filter(c => (c != ',') && (c != '.')).split(" ").toList.filter(w => ((w.length >= 3) && (w.length <= 6))).mkString(" "))
}

