#K1986. Add Binary Strings

    ID: 24636 Type: Default 1000ms 256MiB

Add Binary Strings

Add Binary Strings

You are given two binary strings, and your task is to compute their sum and return it as a binary string. In other words, given two strings representing binary numbers, you should simulate their addition using binary arithmetic, which involves handling carries appropriately. The addition follows the formula: $$sum = bit_a + bit_b + carry$$ where the new bit is computed as $$sum \mod 2$$ and the carry is $$\lfloor sum/2 \rfloor.$$

You need to handle multiple test cases. For each test case, read two binary strings and output their sum in binary format.

inputFormat

The first line of input contains an integer T which represents the number of test cases. Each of the following T lines contains two space-separated binary strings.

Example:

3
1010 1011
110 101
111 1

outputFormat

For each test case, output a single line containing the binary sum of the two input binary strings.

Example:

10101
1011
1000
## sample
3
1010 1011
110 101
111 1
10101

1011 1000

</p>