Split your string to words like described. Then create an empty array
of lines and an empty temporary string. Loop over your words. In the
loop, pop a word off the words array and append it to the temp.
String. Check for the length of it. If it is more than line_length
push the temp. String to the lines array and break the loop, else do
nothing. Repeat this until your words array is empty (this means
another loop around the described one).
While this is not as elegant as the solution posted before, it might
be understandable by a novice programmer.