Python 
I want to split a string into parts which have at most 5000 characters. (We also need to be aware not to split it when we are in a word, and split it only if we found a space.) 
I iterated through the string character by character, and every 4980 characters I split it into parts, and then if there remains a part which is less than 4980 I translate that too. I am new to python, so I'm sure my method is a mess, which works, but certainly isn't good code. 
I haven't checked for any spaces in the string because in Japanese and Chinese there aren't spaces, but this would need to be checked too so we don't split a word into two parts. 
with open('lightnovel.txt', 'r', encoding="utf8") as f:
file = f.read()
db = 0
partofbook = u''
last = u''
length = len(file)
mult = 0
for character in file:
    db = db + 1
    partofbook = partofbook + character
    if db > 4880:
        mult += 1
        db = 0
        trans(partofbook)
        partofbook = u''
    elif length - (mult * 4980) > 0 and length - (mult * 4980) < 5000 :
        last = last + character
        do = 1
if do == 1:
    trans(last)
 
     
    