# Dont understand one test case ["Don't go around saying the","world owes you a living; the","world owes you nothing; it was","here first. "]

• ``````input: ["Don't","go","around","saying","the","world","owes","you","a","living;","the","world","owes","you","nothing;","it","was","here","first."]
30
``````
``````expected:
["Don't  go  around  saying  the","world  owes  you a living; the","world owes you nothing; it was","here first.                   "]
``````
``````my output:
["Don't  go  around  saying  the","world   owes you a living; the","world owes you nothing; it was","here first.                   "]
``````

I dont understand why second line when number of spaces on a line do not divide evenly between words the number of spaces between "world" and "owes" is not 3

• If the spaces on a line don't involve evenly, then distribute the remainder evenly from the beginning of the line. On the second line you have:

• 6 words (23 characters)
• 7 spaces (30 - 23) to distribute between the 6 words.

7 % 5 = 2, so after allocating one space between each of the words, you have 2 spaces left over to do something with. Put one extra space between the first and second word, and one extra space between the second and the third word.

Hope this helps...

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.