13505 - String Calculator(class) 2   

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 lines.

For each a b op, output the calculation result.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13505.cpp

Partial Judge Header

13505.h

Tags

overflow



Discuss