classSolution(object):defreverseVowels(self,s):""" :type s: str :rtype: str """ifnots:returnsl=0r=len(s)-1ret=[iforiins]vowel="aeiouAEIOU"whilel<r:# find the vowel from leftwhilel<randret[l]notinvowel:l+=1# find the vowel from rightwhilel<randret[r]notinvowel:r-=1ifl<r:ret[l],ret[r]=ret[r],ret[l]l+=1r-=1return"".join(ret)