What we know already
Every input character appears in the output, except possibly for white-space characters (spaces, new-lines, etc.)
White space must be rearranged to ensure that output lines are as long as possible without being too long
Rearrangement might replace spaces by new-lines and vice versa