Inverzija
You are given two binary numbers of the same length, A and B. Number A is to be transformed into number B. One transformation consists of choosing an arbitrary subsequence of bits of the number A and inversion of all the bits in the subsequence. Inversion means that the bit 0 becomes 1, and bit 1 becomes 0.
Find the minimum number of transformations needed to transform A into B.
InputThe first line of the standard input contains the number A, and the second line contains the number B (1 <= length(A) = length(B) <= 1.000.000). Numbers A and B will contain characters 0 and 1 only.
OutputTo the standard output print one integer - minimum number of transformations needed to transform number A into number B.
Input:
01110001
01000011Output:
2Explanation: One way of getting 01000011 from 01110001 is using the following transformations
1. Inverting subsequence [3, 7]: 01110001 -> 01001111
2. Inverting subsequence [5, 6]: 01001111 -> 01000011
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.