题目链接:https://leetcode.com/problems/reverse-vowels-of-a-string
Write a function that takes a string as input and reverse only the vowels of a string.
Example 1:
Given s = "hello", return "holle".
Example 2:
Given s = "leetcode", return "leotcede".
Note:
The vowels does not include the letter "y".
class Solution(object):
def reverseVowels(self, s):
"""
:type s: str
:rtype: str
"""
vowels=re.findall('(?i)[aeiou]',s)
return re.sub('(?i)[aeiou]',lambda m: vowels.pop(),s)