就只會照做
第二個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