human
Modify the string by swapping continuous vowels or consonants | Function to check if a character is a vowel.
Function to swap two consecutively repeated vowels or consonants.
Traverse through the length of the string.
Check if the two consecutive characters are vowels or consonants.
swap the two characters.
Driver code"
Solution in Python:
assistant
#Here is code to modify the string by swapping continuous vowels or consonants and the other steps required.
 def isVowel ( c ) :
	c = c . lower ( ) ;
	if ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' ) :
		return True ;
	return False ;
def swapRepeated ( string ) :
	for i in range ( len ( string ) - 1 ) :
		if ( ( isVowel ( string [ i ] ) and isVowel ( string [ i + 1 ] ) ) or ( not ( isVowel ( string [ i ] ) ) and not ( isVowel ( string [ i + 1 ] ) ) ) ) :
			( string [ i ] , string [ i + 1 ] ) = ( string [ i + 1 ] , string [ i ] ) ;
	string = " " . join ( string )
	return string ;
if __name__ == " _ _ main _ _ " :
	string = " geeksforgeeks " ;
	print ( swapRepeated ( list ( string ) ) ) ;