data = []

begin
  while line = $stdin.gets.chomp
    break if line == ""
    data.push(line.split(" "))
  end
rescue
end

data.each{|d|
  puts d.map{|word| word.gsub(",", "").gsub(".","") }.select{|word| word.length > 2 && word.length < 7 }.join(" ")
}