#P423. 练72.4 口算练习题
练72.4 口算练习题
Description
Teacher Wang is teaching basic arithmetic operations. The careful teacher has collected mental arithmetic problems that students often get wrong and wants to organize them into a practice set. Arranging these problems is a tedious task, so he wants to use a computer program to improve efficiency. Teacher Wang hopes to minimize input work - for example, for the expression , he only needs to input and . The output should be detailed enough to facilitate later typesetting, such as outputting and the total length of the expression for the above input. Teacher Wang has entrusted this honorable task to you, please help him implement this functionality.
Input Format
The first line contains an integer ().
The next lines contain the expressions to be input, each line may have either three or two numbers.
If a line has three numbers, the first number indicates the operation type: for addition, for subtraction, for multiplication, followed by two numbers and representing the operands.
If a line has two numbers and , it means the operation type is the same as the previous problem, and these two numbers are the operands.
The data guarantees that the first expression has three numbers, and .
Output Format
Output lines. For each input expression, the first line outputs the complete expression and result, and the second line outputs the total length of the expression.
Sample
4
a 64 46
275 125
c 11 99
b 46 6464+46=110
9
275+125=400
11
11*99=1089
10
46-64=-18
9