PROBLEM5 - ALIGNSUBTRACT

no tags 

Given an expression you’ve to print the result in the required format.

Input

The first line is an integer t which denotes the number of test cases. Each test case consists of an expression which has a number followed by ‘-‘  followed by another number(no space in between them)

Output

For each test case print the result as shown in the example test case. The number of ‘-‘(dashes) should be equal to the maximum of number of non-space characters to the line above it and below it. {in case 1, max("-11111".length(), "52334122".length()) = 8 }

Everything should be right aligned.

Note

This problem uses the exact judge. (You must not print any unnecessary spaces or new lines). Output should not contain any empty lines except the EOF.

You must print a new line after the last test case. (Similar to other test cases. Just to simplify)

Constraints

  • The first number is always greater than or equal to the second number.
  • Both numbers can have an at most of 100 digits.

Example

Input:
4
52345233-11111
9999-9999
82930-79934
10000-99

Output:
52345233
  -11111
--------
52334122
 9999
-9999
-----
    0
 82930
-79934
------
  2996
10000
  -99
 ----
 9901

hide comments
cegprakash: 2016-10-27 07:04:31

@Martin : it should be max("-99".length(), "9901".length()) which is 4.

Martin: 2014-06-12 12:04:32

@cegprakash ,

10000
-99
----
9901

isn't it wrong?

10000.length() = 5 and the number of dashes is 4 instead of 5


Added by:cegprakash
Date:2011-03-04
Time limit:0.5s-1.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: BF