1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (English)/反转字符串中的元音字母(English) [reverse-vowels-of-a-string].html

33 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2022-03-27 20:56:26 +08:00
<p>Given a string <code>s</code>, reverse only all the vowels in the string and return it.</p>
2023-12-09 18:42:21 +08:00
<p>The vowels are <code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, and <code>&#39;u&#39;</code>, and they can appear in both lower and upper cases, more than once.</p>
2022-03-27 20:56:26 +08:00
<p>&nbsp;</p>
2023-12-09 18:42:21 +08:00
<p><strong class="example">Example 1:</strong></p>
2025-01-09 20:29:41 +08:00
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;IceCreAm&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;AceCreIm&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>The vowels in <code>s</code> are <code>[&#39;I&#39;, &#39;e&#39;, &#39;e&#39;, &#39;A&#39;]</code>. On reversing the vowels, s becomes <code>&quot;AceCreIm&quot;</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;leetcode&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;leotcede&quot;</span></p>
</div>
2022-03-27 20:56:26 +08:00
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 3 * 10<sup>5</sup></code></li>
<li><code>s</code> consist of <strong>printable ASCII</strong> characters.</li>
</ul>