ONP  Transform the Expression
Transform the algebraic expression with brackets into RPN form (Reverse Polish Notation). Twoargument 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).
Input
t [the number of expressions <= 100] expression [length <= 400] [other expressions]
Text grouped in [ ] does not appear in the input file.
Output
The expressions in RPN form, one per line.
Example
Input: 3 (a+(b*c)) ((a+b)*(z+x)) ((a+t)*((b+(a+c))^(c+d))) Output: abc*+ ab+zx+* at+bac++cd+^*
hide comments
x0r19x91:
20180322 15:05:30
0.00 sec in ASM 

hello_world123:
20180317 09:40:34
Solved without stack data structure !!!


stevefan1999:
20180208 10:16:33
You can try the Shunting Yard approach, or even go for RD parsing using a LL(k) grammar.


srjsunny:
20180205 21:15:08
no need to consider the special cases i.e. when parenthesis are not there. 

hsraktu:
20180126 21:51:20
Since expression is given in fully parenthesised format (as in examples) there is no need to take care of priorities of operators... 

kimchiboy03:
20180116 12:20:18
A stack is not required in this problem. However, it is easier to use a stack! Last edit: 20180116 12:20:45 

anaphase21:
20180106 04:27:05
AC in one go (0.08s with Java) Last edit: 20180106 04:27:44 

spartax:
20180105 06:51:25
Stacks are required always 

spartax:
20180105 06:49:19
AC using assembly 

abigail_ii:
20171228 20:14:11
@ajay_raj_: You don't need a stack. I've solved mine using regular expressions and recursion. 
Added by:  mima 
Date:  20040501 
Time limit:  5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL6 VB.NET 
Resource:   