Mark As Completed Discussion

Recovering Lines from split

Once split array is filled, we can recover the word boundaries for each line. The following code recovers the lines of text in our final solution. In the code, lineEnd is a list that stores the index of the last word in each line. Its computation is also shown in the last figure.

Once the line endings are determined, we can justify text by inserting the right amount of spaces between words, which is easy to do.

TEXT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment