就只会照做
第二个for loop应该可以改一下
不用每次都从头找
大概是这样
def sortVowels(self, s: str) -> str:
count = Counter(s)
rets = ""
for c in s:
if c in {'A','E','I','O','U','a','e','i','o','u'}:
for t_c in ['A','E','I','O','U','a','e','i','o','u']:
if count[t_c]>0:
rets += t_c
count[t_c] -= 1
break
else:
rets += c
return rets