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
Michael:
20151012 21:04:55
In my case it's:


yeahboy:
20151003 12:01:25
how if the input is (a(b*c)w(l(de)*(f+g)+h)^(i*(jk)/p)) ??


gj_21:
20150927 09:25:26
finally after 7 submissions made my day :D


catigern:
20150926 18:27:46
Please not that in the question it has been specified, that this a two argument operations inside a bracket, so cases like (a^b + c) don't arise, hence priority of operators doesn't matter 

codocalypse:
20150923 19:26:37
Priority of operators is of none importance as the infix expression is completely under brackets ! 

animi_murali:
20150905 19:43:09
my code is getting runtime error here. It works fine in other IDEs my code id :15070253 

Amritendu Mondal:
20150810 11:17:21
I didn't use stack but a tree to store the expression. Good problem , happy to solve this type. 

gaurav:
20150808 09:48:11
Are there any boundary conditions we need to check for?


MishThi:
20150805 11:46:31
Taught me about how stacks function. A great problem for beginners to learn about Stacks. Also, my 49th. :D 

c_lauw97:
20150801 07:18:47
if the input was (a+b^c) , the output should be abc^+ ? true or not? need explanation for several test case 
Added by:  Michał Małafiejski 
Date:  20040501 
Time limit:  5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel Pentium G860 3GHz) 
Languages:  All except: NODEJS PERL 6 VB.net 
Resource:   