import sys

line = raw_input()
word_list = line.translate(None, '.,').split()
ans = []
for word in word_list:
    if len(word) >= 3 and len(word) <= 6:
        ans.append(word)

for i, w in enumerate(ans):
    if i != 0:
        sys.stdout.write(" ")
    sys.stdout.write(w)
sys.stdout.write("\n")