#Lutece0836. Kia's Calculation
Kia's Calculation
Migrated from Lutece 836 Kia's Calculation
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Doctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the sum of two digits exceeds . For example, when she calculates , she will get , and for , she will get . Ghee is angry about this, and makes a hard problem for her to solve:
Now Kia has two integers and , she can shuffle the digits in each number as she like, but leading zeros are not allowed. That is to say, for , she can rearrange the number as , or , or many other, but is not allowed.
After she shuffles and , she will add them together, in her own way. And what will be the maximum possible sum of +
?
Input
The first line has a number () , indicating the number of test cases.
For each test case there are two lines. First line has the number , and the second line has the number .
Both and will have same number of digits, which is no larger than , and without leading zeros.
Output
For test case , output Case #X:
first, then output the maximum possible sum without leading zeros.
Samples
1
5958
3036
Case #1: 8984
Resources
2013 ACM-ICPC China Chengdu Provincial Programming Contest