|
| 1 | +<p>You are given a string <code>word</code> and a <strong>non-negative</strong> integer <code>k</code>.</p> |
| 2 | + |
| 3 | +<p>Return the total number of <span data-keyword="substring-nonempty">substrings</span> of <code>word</code> that contain every vowel (<code>'a'</code>, <code>'e'</code>, <code>'i'</code>, <code>'o'</code>, and <code>'u'</code>) <strong>at least</strong> once and <strong>exactly</strong> <code>k</code> consonants.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<div class="example-block"> |
| 9 | +<p><strong>Input:</strong> <span class="example-io">word = "aeioqq", k = 1</span></p> |
| 10 | + |
| 11 | +<p><strong>Output:</strong> <span class="example-io">0</span></p> |
| 12 | + |
| 13 | +<p><strong>Explanation:</strong></p> |
| 14 | + |
| 15 | +<p>There is no substring with every vowel.</p> |
| 16 | +</div> |
| 17 | + |
| 18 | +<p><strong class="example">Example 2:</strong></p> |
| 19 | + |
| 20 | +<div class="example-block"> |
| 21 | +<p><strong>Input:</strong> <span class="example-io">word = "aeiou", k = 0</span></p> |
| 22 | + |
| 23 | +<p><strong>Output:</strong> <span class="example-io">1</span></p> |
| 24 | + |
| 25 | +<p><strong>Explanation:</strong></p> |
| 26 | + |
| 27 | +<p>The only substring with every vowel and zero consonants is <code>word[0..4]</code>, which is <code>"aeiou"</code>.</p> |
| 28 | +</div> |
| 29 | + |
| 30 | +<p><strong class="example">Example 3:</strong></p> |
| 31 | + |
| 32 | +<div class="example-block"> |
| 33 | +<p><strong>Input:</strong> <span class="example-io">word = "</span>ieaouqqieaouqq<span class="example-io">", k = 1</span></p> |
| 34 | + |
| 35 | +<p><strong>Output:</strong> 3</p> |
| 36 | + |
| 37 | +<p><strong>Explanation:</strong></p> |
| 38 | + |
| 39 | +<p>The substrings with every vowel and one consonant are:</p> |
| 40 | + |
| 41 | +<ul> |
| 42 | + <li><code>word[0..5]</code>, which is <code>"ieaouq"</code>.</li> |
| 43 | + <li><code>word[6..11]</code>, which is <code>"qieaou"</code>.</li> |
| 44 | + <li><code>word[7..12]</code>, which is <code>"ieaouq"</code>.</li> |
| 45 | +</ul> |
| 46 | +</div> |
| 47 | + |
| 48 | +<p> </p> |
| 49 | +<p><strong>Constraints:</strong></p> |
| 50 | + |
| 51 | +<ul> |
| 52 | + <li><code>5 <= word.length <= 2 * 10<sup>5</sup></code></li> |
| 53 | + <li><code>word</code> consists only of lowercase English letters.</li> |
| 54 | + <li><code>0 <= k <= word.length - 5</code></li> |
| 55 | +</ul> |
0 commit comments