문제
1451. Rearrange Words in a Sentence
Medium
405
57
Add to List
Share
Given a sentence
text
(A sentence is a string of space-separated words) in the following format:- First letter is in upper case.
- Each word in
text
are separated by a single space.
Your task is to rearrange the words in text such that all words are rearranged in an increasing order of their lengths. If two words have the same length, arrange them in their original order.
Return the new text following the format shown above.
Example 1:
Example 2:
Example 3:
풀이
재영
효성
- substr은 Deprecated...
- 굳이 배열로 저장 안해도 될 것 같아요. 0과 1이 무엇을 나타내는지 헷갈림..