Longest String Made Up Of Only Vowels

Given a string of lower characters, remove at most two substrings of any length from the given string such that the remaining string contains vowels('a','e','i','o','u') only.

Your aim is to maximize the length of the remaining string. Output the length of the remaining string after removal of at most two substrings.

NOTE: The answer may be 0, i.e. removing the entire string.


Example 1:

Output: 2

Example 2:

Output: 3

Try it yourself