s=" "

x=input().replace(",",s).replace(".",s).split()

print(s.join([w for w in x if 2<len(w)<7]))
s=" "

x=input().replace(",",s).replace(".",s).split()

x=s.join([w for w in x if 2<len(w)<7])

print(x)
s = " "
x = input().replace(",", s).replace(".", s).split()
print(s.join([w for w in x if 2 < len(w) < 7]))

s = " "
x = input().replace(",", s).replace(".", s).split()
x = s.join([w for w in x if 2 < len(w) < 7])
print(x)

-print(s.join([w for w in x if 2 < len(w) < 7])) +x = s.join([w for w in x if 2 < len(w) < 7]) +print(x)