f = open("input.txt")
a = f.read()
f.close()
chars = [",", "!", ".", ":",";", "?"]
for char in chars:
a = a.replace(char, " ")
a = list(a.split())
b = []
for word in a:
if len(word) <= 5:
b.append(word)
out = ', '.join(b)
f = open("output.txt", "w+")
f.write(out)
f = open("input.txt")
a = f.read()
f.close()
chars = [",", "!", ".", ":",";", "?"]
for char in chars:
a = a.replace(char, " ")
a = list(a.split())
b = []
for word in a:
if len(word) <= 5:
b.append(word)
out = ', '.join(b)
f = open("output.txt", "w+")
f.write(out)
f.close()