Addition Errors

3.6

38 votes
Basic Programming, Basics of Implementation, Cakewalk, Easy, Implementation
Problem

Bob is a noob mathematician and he is not very comfortable with addition of numbers.He is unaware of the concept of carry that the addition of 2 numbers possess.He everytime forgets to take a carry while performing addition.

Example: suppose he adds 5 and 8 so he writes only 3 instead of 13. Similarly while adding 18 and 223 he writes it as 231.

So basically he ignores the carry everytime.You task is to compute the error in his addition algorithm.

Error is defined as the absolute difference between Bob's answer and the actual answer which was expected.

Input Format

First line contains T (the number of Test Cases).

Each testcase contains 2 lines containing numbers A and B.(the numbers which Bob uses to perform an addition).

Output Format

For each testcase print the error value in a new line.

Constraints

1T105

1A,B1018

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test Case 1:

Actual Answer = 2+2=4

Bob's Answer = 4

Error=0

Test Case 2:

Actual Answer = 5+8=13

Bob's Answer = 3

Error=10

Editor Image

?