human
Encrypt string with product of number of vowels and consonants in substring of size k | isVowel ( ) is a function that returns true for a vowel and false otherwise ..
function to Encrypt the string.
cv to count vowel cc to count consonants.
Counting prefix count of vowel and prefix count of consonants.
generating the encrypted string ..
Driver Code"
Solution in Python:
 ... What is a code to encrypt string with product of number of vowels and consonants in substring of size k and the other steps required?
assistant
#Here is code to encrypt string with product of number of vowels and consonants in substring of size k and the other steps required.
 def isVowel ( c ) :
	return ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' )
def encryptString ( s , n , k ) :
	cv = [ 0 for i in range ( n ) ]
	cc = [ 0 for i in range ( n ) ]
	if ( isVowel ( s [ 0 ] ) ) :
		cv [ 0 ] = 1
	else :
		cc [ 0 ] = 1
	for i in range ( 1 , n ) :
		cv [ i ] = cv [ i - 1 ] + isVowel ( s [ i ] )
		cc [ i ] = cc [ i - 1 ] + ( isVowel ( s [ i ] ) == False )
	ans = " "
	prod = 0
	prod = cc [ k - 1 ] * cv [ k - 1 ]
	ans += str ( prod )
	for i in range ( k , len ( s ) ) :
		prod = ( ( cc [ i ] - cc [ i - k ] ) * ( cv [ i ] - cv [ i - k ] ) )
		ans += str ( prod )
	return ans
if __name__ == ' _ _ main _ _ ' :
	s = " hello "
	n = len ( s )
	k = 2
	print ( encryptString ( s , n , k ) )