> For the complete documentation index, see [llms.txt](https://nataliekung.gitbook.io/ladder_code/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nataliekung.gitbook.io/ladder_code/qiang-hua-4-shuang-zhi-zhen-ff09/reverse-vowels-of-a-string.md).

# Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.

**Example 1:**

```
Input: 
"hello"
Output: 
"holle"
```

**Example 2:**

```
Input: 
"leetcode"
Output: 
"leotcede"
```

**Note:**\
The vowels does not include the letter "y".

分析

string里的swap char， 先转成List(str) ,swap完了再''.join(list)

注意包括大写

```
class Solution:
    def reverseVowels(self, s: str) -> str:
        l = len(s)
        ss,e = 0,l-1
        s = list(s)
        while ss < e:
            while ss < e and s[ss] not in 'aeiouAEIOU':
                ss += 1
            while ss < e and s[e] not in 'aeiouAEIOU':
                e -= 1
            s[ss],s[e] = s[e],s[ss]
            ss += 1
            e -= 1

        return ''.join(s)
```
