human
Number of ways to swap two bit of s1 so that bitwise OR of s1 and s2 changes | Function to find number of ways.
initialise result that store No . of swaps required.
Traverse both strings and check the bits as explained.
calculate result.
Driver code"
How can the above be solved in Python?
 Write me a code to number of ways to swap two bit of s1 so that bitwise OR of s1 and s2 changes and the other steps required?
assistant
#Here is code to number of ways to swap two bit of s1 so that bitwise OR of s1 and s2 changes and the other steps required.
 def countWays ( s1 , s2 , n ) :
	a = b = c = d = 0
	result = 0 ;
	for i in range ( 0 , n , 1 ) :
		if ( s2 [ i ] == '0' ) :
			if ( s1 [ i ] == '0' ) :
				c += 1 ;
			else :
				d += 1
		else :
			if ( s1 [ i ] == '0' ) :
				a += 1
			else :
				b += 1
	result = a * d + b * c + c * d
	return result
if __name__ == ' _ _ main _ _ ' :
	n = 5
	s1 = "01011"
	s2 = "11001"
	print ( countWays ( s1 , s2 , n ) )