In this case: only one digit 1 is counted, and it is unmatched for all the place, so 0A1B.

Input:

"1234"

"0111"

Output:

"0A3B"

Expected:

"0A1B"

In this case: two digits, 1, and 2, both are in wrong place, so I think it should be 0A2B, but the answer is 0A4B, so it double counts the unmatched digits. This really confused me.

Input:

"1122"

"2211"

Output:

"0A2B"

Expected:

"0A4B"

I think I misunderstood the rule of "bull and cow", could someone explain this? Thanks.