s = gets.chomp
s = s.split(',').join(' ')
s = s.split('.').join(' ')
ar = s.split(' ')
ls = []
for i in 0...ar.length
  t = ar[i]
  ls.push(t) if 3<=t.length && t.length<=6
end
print ls[0]
for i in 1...ls.length
  print " ",ls[i]
end
print "\n"