Design and implement a left and right justification algorithm that inserts extra spaces after the longest word first, then after the second longest word and so on. In your implementation by making certain assumptions, try to avoid having to do a sort. This approach usually produces an aesthetically more pleasing output.