1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/每个元音包含偶数次的最长子字符串 [find-the-longest-substring-containing-vowels-in-even-counts].html
2022-03-29 12:43:11 +08:00

37 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个字符串&nbsp;<code>s</code>&nbsp;,请你返回满足以下条件的最长子字符串的长度:每个元音字母,即&nbsp;&#39;a&#39;&#39;e&#39;&#39;i&#39;&#39;o&#39;&#39;u&#39; ,在子字符串中都恰好出现了偶数次。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>s = &quot;eleetminicoworoep&quot;
<strong>输出:</strong>13
<strong>解释:</strong>最长子字符串是 &quot;leetminicowor&quot; ,它包含 <strong>eio</strong>&nbsp;各 2 个,以及 0 个 <strong>a</strong><strong>u </strong>
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>s = &quot;leetcodeisgreat&quot;
<strong>输出:</strong>5
<strong>解释:</strong>最长子字符串是 &quot;leetc&quot; ,其中包含 2 个 <strong>e</strong>
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>s = &quot;bcbcbc&quot;
<strong>输出:</strong>6
<strong>解释:</strong>这个示例中,字符串 &quot;bcbcbc&quot; 本身就是最长的,因为所有的元音 <strong>a</strong><strong>e</strong><strong>i</strong><strong>o</strong><strong>u</strong> 都出现了 0 次。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 5 x 10^5</code></li>
<li><code>s</code>&nbsp;只包含小写英文字母。</li>
</ul>