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".
The answer to the bright blind baby's eyes must be widely publicized, "excerpted from Https://leetcode.com/discuss/99073/1-2-lines-python-ruby":
class solution (Object): def Reversevowels (self, s): """ : Type s:str : rtype:str " " "= Re.findall ('(? i) [ AEIOU]', s) return re.sub ('(? i) [Aeiou]' Lambda m:vowels.pop (), s)
Use regular expressions to find all vowels
eg:s= ' Hello ' then vowels = [' e ', ' O ']
Re.sub's function prototype is: re.sub (Pattern, REPL, string, count)
Where the second function is the replacement string;
The fourth parameter refers to the number of replacements. The default is 0, which means that each match is replaced
345. Reverse vowels of a String