human
Replace ' ? ' in a string such that no two adjacent characters are same | Function that replace all ' ? ' with lowercase alphabets such that each adjacent character is different.
Store the given String.
If the first character is '?.
Traverse the String [ 1 , N - 1 ].
If the current character is '?.
Change the character.
Check equality with the previous character.
Check equality with the next character.
Check equality with the previous character.
If the last character is '?.
Change character.
Check with previous character.
Return the resultant String.
Driver Code.
Given String S.
Function Call"
How can the above be solved in Python?
 ... Write me a code to replace '?
assistant
#Here is code to replace ' .
 def changeString ( S ) :
	N = len ( S )
	s = [ ' ▁ ' ] * ( len ( S ) )
	for i in range ( len ( S ) ) :
		s [ i ] = S [ i ]
'
	if ( s [ 0 ] == ' ? ' ) :
		s [ 0 ] = ' a '
		if ( s [ 0 ] == s [ 1 ] ) :
			s [ 0 ] = chr ( ord ( s [ 0 ] ) + 1 )
	for i in range ( 1 , N - 1 ) :
'
	if ( s [ i ] == ' ? ' ) :
		s [ i ] = ' a '
		if ( s [ i ] == s [ i - 1 ] ) :
			s [ i ] = chr ( ord ( s [ i ] ) + 1 )
		if ( s [ i ] == s [ i + 1 ] ) :
			s [ i ] = chr ( ord ( s [ i ] ) + 1 )
		if ( s [ i ] == s [ i - 1 ] ) :
			s [ i ] = chr ( ord ( s [ i ] ) + 1 )
'
	if ( s [ N - 1 ] == ' ? ' ) :
		s [ N - 1 ] = ' a '
		if ( s [ N - 1 ] == s [ N - 2 ] ) :
			s [ N - 1 ] += 1
	ans = " "
	for i in range ( len ( s ) ) :
		ans += s [ i ]
	return ans
if __name__ == ' _ _ main _ _ ' :
	S = " ? a ? a "
	print ( changeString ( S ) )