
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
While generating substrings starting at any index, do you need to continue generating larger substrings if you encounter a consonant?
Can you store the count of characters to avoid generating substrings altogether?