HTMLify
LeetCode | Reverse Vowels of a String | Python
Views: 235 | Author: abh
class Solution:
def reverseVowels(self, s: str) -> str:
rvs = ""
for c in s[::-1]:
if c in "aeiouAEIOU":
rvs += c
ns = ""
p = 0
for c in s:
if c in "aeiouAEIOU":
ns += rvs[p]
p += 1
else:
ns += c
return ns