human
Length of the longest substring that contains even number of vowels | Function to find the length of the longest substring having even number of vowels.
Create two hashmaps.
Keep the track of frequencies of the vowels.
Stores the maximum length.
Traverse the given string S.
If it is a vowel , then update the frequency.
Find the index of occurence of the string evenOdd in map.
Update the maximum length.
Print the maximum length.
Driver Code"
How can the above be solved in Python?
 What is a code to length of the longest substring that contains even number of vowels and the other steps required?
assistant
#Here is code to length of the longest substring that contains even number of vowels and the other steps required.
 def longestSubstring ( s ) :
	indexes = { }
	chars = { }
	chars [ ' a ' ] = 0
	chars [ ' e ' ] = 1
	chars [ ' i ' ] = 2
	chars [ ' o ' ] = 3
	chars [ ' u ' ] = 4
	evenOdd = "00000"
	evenOdd = [ i for i in evenOdd ]
	indexes [ " " . join ( evenOdd ) ] = - 1
	length = 0
	for i in range ( len ( s ) ) :
		c = s [ i ]
		if ( c in chars ) :
			evenOdd [ chars [ it ] ] = '1' if evenOdd [ chars [ it ] ] else '0'
		if ( " " . join ( evenOdd ) not in indexes ) :
			indexes [ " " . join ( evenOdd ) ] = i
		else :
			length = max ( length , i - indexes [ " " . join ( evenOdd ) ] )
	print ( length )
if __name__ == ' _ _ main _ _ ' :
	S = " bcbcbc "
	longestSubstring ( S )