解题思路:按照长度重新排列单词
class Solution:
def arrangeWords(self, text: str) -> str:
items = text.split(' ')
start = items[0]
items.sort(key=lambda x: len(x))
index = items.index(start)
if index != 0:
first = chr(ord(items[0][0])-32)
items[0] = first + items[0][1:]
first = chr(ord(items[index][0])+32)
items[index] = first + items[index][1:]
return ' '.join(items)