Bit Friendship Index

Given two equal-length binary strings, find the minimum number of digit changes and character swaps to make them identical.

Medium4StringGreedyMathInterviewNo attempts yetTime limit1sMemory limit128 MB

Problem

Jinhong likes numbers. While playing with them today he worked out the bit friendship index of two numbers.

The bit friendship index of two binary numbers is the smallest number of operations needed to make them equal. Two operations are allowed.

  1. In one of the two binary numbers, change the digit at any position to 0 or 1.
  2. In one of the two binary numbers, swap the digits at two different positions.

For example, take the decimal numbers 11 and 12. In binary they are 1011 and 1100. Changing the digit in the 2s place of 1011 to 0 gives 1001, and swapping the digit in the 1s place with the digit in the 4s place then gives 1100. Two operations are enough and no shorter sequence exists, so the bit friendship index of 11 and 12 is 2.

Jinhong wants a program that takes two numbers and reports their bit friendship index. He is weak at programming and can only convert a decimal number to binary. Help him and write that program.

Input

The first line contains the number of test cases TT (1T501 \le T \le 50).

Each test case is a single line holding two binary numbers NN and MM separated by a space. NN and MM have the same digit count, and that count is at most 1,000,000. Leading zeros can appear.

Output

For each test case, print the bit friendship index of NN and MM on its own line.