13505 - String Calculator(class) 2
|
Time |
Memory |
Case 1 |
1 sec |
32 MB |
Case 2 |
1 sec |
32 MB |
Case 3 |
1 sec |
32 MB |
Case 4 |
1 sec |
32 MB |
Case 5 |
1 sec |
32 MB |
Case 6 |
1 sec |
32 MB |
Case 7 |
1 sec |
32 MB |
Case 8 |
1 sec |
32 MB |
Case 9 |
1 sec |
32 MB |
Case 10 |
1 sec |
32 MB |
Description
In this problem, you need to finish a string calculator.
The calculator has three string operators:
- a + b: Concatenate the string b after the string a.
- a - b: If string b has appeared in string a, delete the first appearance of b in a, otherwise the result is "error".
- a @ b:
If b is an integer, a should be right-shifted b times, according to the following letter order: 0, 1, 2, ... , 9, a, b, ..., z. Otherwise the result is "error".
- For example:
a = abcxyz, b = 3, result = def012 (that is, 'a'->'d', 'b'->'e', ..., and 'z'->'2'.)
Input
The first line contains an integer N
The following N lines, each line contains two string a b and a operation op.
testcases:
(3/10) 1 <= N <= 100, 1 <= |a|, |b| <= 100, op = '+'
(3/10) 1 <= N <= 100, 1 <= |a|, |b| <= 100, op = '-'
(4/10) 1 <= N <= 100, 1 <= |a|, |b| <= 100, op = '@'
Output
The output contains N lines.
For each a b op, output the calculation result.
Partial Judge Code
13505.cpp
Partial Judge Header
13505.h
Tags
overflow