Given a sentence and maxWidth. Arrange the text in such a way that each line has exactly maxWidth characters and is fully justified.
Your answer should be of greedy approach. You should pack as many words you can in each line. If you cannot fit the whole word, then fill the…