arr = []
line = gets.chomp
add = ""
line.each_char{|c|
    if c == ',' || c == '.' || c == ' '
        arr << add if add.length.between?(3, 6)
        add = ""
    else
        add += c
    end
}
arr << add if add.length.between?(3, 6)
puts arr.join(" ")
