algorithms.tutorialhorizon.com
Text Justification Problem (OR Word Wrap Problem) | Algorithms
Given a list of words and length L. Format the words so that each line will have only L characters and fully justified (left and right justified). You need to fit as many as words in every line. You are not allowed to split a word and put them in next line. Pad extra spaces ' ' if needed so that each line has L characters.