Score : 1000 points
You have two strings A = A_1 A_2 ... A_n and B = B_1 B_2 ... B_n of the same length consisting of 0 and 1.
You can transform A using the following operations in any order and as many times as you want:
You goal is to make strings A and B equal.
Print the smallest number of operations required to achieve this, or -1 if the goal is unreachable.
Input is given from Standard Input in the following format:
A B
Print the smallest number of operations required to make strings A and B equal, or -1 if the goal is unreachable.
1010 1100
3
Here is one fastest way to achieve the goal:
1 0
-1
There is no way to flip the only bit in A.
11010 10001
4
Here is one fastest way to achieve the goal:
0100100 1111111
5
Flip A_1, A_3, A_4, A_6 and A_7 in any order.