ONP - Transform the Expression

题意翻译

### 题目描述 请你将 $n$ 个中缀表达式转换为后缀表达式。 ### 输入格式 第一行一个整数 $n$ 代表中缀表达式个数。 接下来 $n$ 行代表 $n$ 个中缀表达式。 ### 输出格式 $n$ 行代表每个中缀表达式转换过来的后缀表达式。 ### 说明 / 提示 对于 $100\%$ 的数据,$n \le 100$ , 表达式长度 $\le 400$ 。 Translated by @[稀神探女](/user/85216)

题目描述

Transform the algebraic expression with brackets into RPN form (Reverse Polish Notation). Two-argument operators: +, -, \*, /, ^ (priority from the lowest to the highest), brackets ( ). Operands: only letters: a,b,...,z. Assume that there is only one RPN form (no expressions like a\*b\*c).

输入输出格式

输入格式


``` t [the number of expressions <= 100] expression [length <= 400] [other expressions] ``` Text grouped in \[ \] does not appear in the input file.

输出格式


``` The expressions in RPN form, one per line. ```

输入输出样例

输入样例 #1

3
(a+(b*c))
((a+b)*(z+x))
((a+t)*((b+(a+c))^(c+d)))

输出样例 #1

abc*+
ab+zx+*
at+bac++cd+^*