Pro.ID21974 TitleCalculator Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21974 AC0 Submit0 Ratio- 时间&空间限制描述A simple 8-digit electronic calculator contains the following buttons: "1234567890+-*/=" (no quotes). It can be divided into the following categories: Digit: "1234567890" You can input any number with digital buttons (ignore leading zero). Notice, the LED of calculator can only display 8 digits. So when the number of digits large than eight, only the first eight digits will be retained. And when the number of one result's digits large than eight, error occurs. Operator: "+-*/" For simplicity, all operations are integer operations. Some continuous operators, the last one is valid. When an operator button is pressed, the calculation before that will be completed. Example of type "11+/2+"
Equal-sign: "=" If the second operand is missing, you can think it equal the first operand. More than one continuous equal-sign means repeat the operation. You can observe the following examples. Example of type "11+*=="
Example of type "3==+5="
Example of type "5=7=+8="
输入The first line is number of test cases. After that, each case consists of one line, containing a string means pressed button. The length of string is less than 100. There is no additional space. 输出Description A simple 8-digit electronic calculator contains the following buttons: "1234567890+-*/=" (no quotes). It can be divided into the following categories: Digit: "1234567890" You can input any number with digital buttons (ignore leading zero). Notice, the LED of calculator can only display 8 digits. So when the number of digits large than eight, only the first eight digits will be retained. And when the number of one result's digits large than eight, error occurs. Operator: "+-*/" For simplicity, all operations are integer operations. Some continuous operators, the last one is valid. When an operator button is pressed, the calculation before that will be completed. Example of type "11+/2+"
Equal-sign: "=" If the second operand is missing, you can think it equal the first operand. More than one continuous equal-sign means repeat the operation. You can observe the following examples. Example of type "11+*=="
Example of type "3==+5="
Example of type "5=7=+8="
Input The first line is number of test cases. After that, each case consists of one line, containing a string means pressed button. The length of string is less than 100. There is no additional space. Output First output the case number. Then output the number of display in the same line. If there is any error occurs, just print Sample Input 6 Sample Output Case 1: 5 Source 样例输入6 样例输出Case 1: 5 提示作者 |