human
Replace consonants with next immediate consonants alphabetically in a String | Function to check if a character is vowel or not.
Function that replaces consonant with next immediate consonant alphabatically.
Start traversing the string.
if character is z , than replace it with character b.
if the alphabet is not z.
replace the element with next immediate alphabet.
if next immediate alphabet is vowel , than take next 2 nd immediate alphabet ( since no two vowels occurs consecutively in alphabets ) hence no further checking is required.
Driver code"
How can the above be solved in Python?
 ... Can you provide a code to replace consonants with next immediate consonants alphabetically in a String and the other steps required?
assistant
#Here is code to replace consonants with next immediate consonants alphabetically in a String and the other steps required.
 def isVowel ( ch ) :
	if ( ch != ' a ' and ch != ' e ' and ch != ' i ' and ch != ' o ' and ch != ' u ' ) :
		return False ;
	return True ;
def replaceConsonants ( s ) :
	for i in range ( len ( s ) ) :
		if ( isVowel ( s [ i ] ) == False ) :
			if ( s [ i ] == ' z ' ) :
				s [ i ] = ' b ' ;
			else :
				s [ i ] = chr ( ord ( s [ i ] ) + 1 ) ;
				if ( isVowel ( s [ i ] ) == True ) :
					s [ i ] = chr ( ord ( s [ i ] ) + 1 ) ;
	return ' ' . join ( s ) ;
s = " geeksforgeeks " ;
print ( replaceConsonants ( list ( s ) ) ) ;