You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
576 B
23 lines
576 B
#!/usr/bin/python3
|
|
#this script splits text on space with a maximum of 240 characters
|
|
#but on whole words. because icy_medata has a max of 255 characters.
|
|
import sys
|
|
|
|
text = sys.stdin.readlines()
|
|
output = []
|
|
line = []
|
|
sentence = ""
|
|
for words in text:
|
|
for word in words.split():
|
|
if len(word) + len(" ".join(line)) < 240:
|
|
line.append(word)
|
|
else:
|
|
output.append(" ".join(line))
|
|
line = []
|
|
line.append(word)
|
|
|
|
"#add the last word"
|
|
output.append(" ".join(line))
|
|
|
|
for line in output:
|
|
print(line.replace(',', ''))
|
|
|