TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description


The end of world is near! One day, the astronomer Readykaka received two numbers from outer space. She cannot correctly decode it. The only thing she knows is to permute two numbers such that the absolute difference between them is minimized. That maybe means the mysterious countdown time (cd time) of next wave...


Please help Readykaka to figure out this important message. Note that we can insert any number of zeroes to these numbers, and leading zeros are allowed. All numbers are calculating on base 10.

Input Format

First line contains an integer T (T<=100) denoting the number of test case. For each test case, contains two integers A and B (0<=A, B<109) seperated by whitespaces.

Output Format

For each test case, please output the answer in a line.

Sample Input 1

5
99 1
25 12
309 196
1 555555555
0 555555555

Sample Output 1

1
4
13
444444445
555555555

Hints

Problem Source

Migrated from old NTUJ.

tmt514

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 5000 65536 200