Given a sentence text consisting of words separated by single spaces, rearrange the words so that they are ordered in non-decreasing order of their lengths. If two or more words have the identical length, preserve their original relative order.
The resulting sentence must have only the first character capitalized, with all subsequent characters in lowercase.
Constraints:
text begins with a capital letter and contains only lowercase English letters and single spaces separating words.
text.length
Given a sentence text consisting of words separated by single spaces, rearrange the words so that they are ordered in non-decreasing order of their lengths. If two or more words have the identical length, preserve their original relative order.
The resulting sentence must have only the first character capitalized, with all subsequent characters in lowercase.
Constraints:
text begins with a capital letter and contains only lowercase English letters and single spaces separating words.
text.length