n = gets.chomp
n1 = n.gsub(/\./," ")
n2 = n1.gsub(/\,/," ")
str = n2.split(" ")
ans = []
str.each do |k|
    k1 = k.split("")
    length = k1.length
    if length <= 6 && length >= 3
        ans << k
    end
end

puts ans.join(" ")
