human
Can you provide a code to check whether all the substrings have number of vowels atleast as that of consonants and the other steps required given the following:
Check whether all the substrings have number of vowels atleast as that of consonants | Function that returns true if acter ch is a vowel.
Compares two integers according to their digit sum.
Check if there are two consecutive consonants.
Check if there is any vowel surrounded by two consonants.
Driver code"
Solution in Python:
assistant
#Here is code to check whether all the substrings have number of vowels atleast as that of consonants and the other steps required.
 def isVowel ( ch ) :
	if ch in [ ' i ' , ' a ' , ' e ' , ' o ' , ' u ' ] :
		return True
	else :
		return False
def isSatisfied ( st , n ) :
	for i in range ( 1 , n ) :
		if ( isVowel ( st [ i ] ) == False and isVowel ( st [ i - 1 ] ) == False ) :
			return False
	for i in range ( 1 , n - 1 ) :
		if ( isVowel ( st [ i ] ) and isVowel ( st [ i - 1 ] ) == False and isVowel ( st [ i + 1 ] ) == False ) :
			return False
	return True
st = " acaba "
n = len ( st )
if ( isSatisfied ( st , n ) ) :
	print ( " Yes " )
else :
	print ( " No " )