Modify a Binary String by flipping characters such that any pair of indices consisting of 1 s are neither co | Function to modify a string such that there doesn 't exist any pair of indices consisting of 1s, whose GCD is 1 and are divisible by each other ; Flips characters at indices 4 N , 4 N - 2 , 4 N - 4 . ... upto N terms ; Print the string ; Driver code ; Initialize the string S ; function call
def findString ( S , N ) : NEW_LINE INDENT strLen = 4 * N NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT S [ strLen - 1 ] = '1' NEW_LINE strLen -= 2 NEW_LINE DEDENT for i in range ( 4 * N ) : NEW_LINE INDENT print ( S [ i ] , end = " " ) NEW_LINE DEDENT DEDENT N = 2 NEW_LINE S = [ 0 ] * ( 4 * N ) NEW_LINE for i in range ( 4 * N ) : NEW_LINE INDENT S [ i ] = '0' NEW_LINE DEDENT findString ( S , N ) NEW_LINE