Longest substring of vowels | Python3 program to find the longest substring of vowels . ; Increment current count if s [ i ] is vowel ; check previous value is greater then or not ; Driver code
def isVowel ( c ) : NEW_LINE INDENT return ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' ) NEW_LINE DEDENT def longestVowel ( s ) : NEW_LINE INDENT count , res = 0 , 0 NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT if ( isVowel ( s [ i ] ) ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT else : NEW_LINE INDENT res = max ( res , count ) NEW_LINE count = 0 NEW_LINE DEDENT DEDENT return max ( res , count ) NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT s = " theeare " NEW_LINE print ( longestVowel ( s ) ) NEW_LINE DEDENT