题目
LeetCode 1451.重新排列句子中的单词
解释
## 题目描述 「句子」是一个用空格分隔单词的字符串。给你一个满足下述格式的句子 text : 句子的首字母大写 text 中的每个单词都用单个空格分隔。 请你重新排列 text 中的单词,使所有单词按其长度的升序排列。如果两个单词的长度相同,则保留其在原句子中的相对顺序。 请同样按上述格式返回新的句子。 ## 示例 **示例 1:** **输入:** text = "Leetcode is cool" **输出:** "Is cool leetcode" **解释:** 句子中共有 3 个单词,长度为 8 的 "Leetcode" ,长度为 2 的 "is" 以及长度为 4 的 "cool" 。 **示例 2:** **输入:** text = "Keep calm and code on" **输出:** "On and keep calm code" **示例 3:** **输入:** text = "To be or not to be" **输出:** "To be or to be not" ## 约束条件 text 以大写字母开头,然后包含若干小写字母以及单词间的单个空格。 1 <= text.length <= 10^5 ## LeetCode 链接 https://leetcode.cn/problems/rearrange-words-in-a-sentence/
答案
正在疯狂整理答案中......