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+^*
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:   
hide comments
sudomudo:
20150719 23:45:01
Use stack, and don't forget to format the output the right way. GG :) 

treyshaffer:
20150719 00:37:02
A good algorithm for solving this problem:


seamel_1:
20150716 16:18:53
Could someone tell me what is wrong in my code http://pastebin.com/fG8x8QTC compile and works well but spoj detects runtime error (SIGSEGV) 

Supreme:
20150714 13:52:23
Tried solving without using stacks  didnt get the solution even after 2 days.


himanshu kumar:
20150713 18:25:28
please do see the priority hehe... giving me one wrong answer :p 

artista_14:
20150628 15:09:30
STL made code shorter......Excellent problem for beginners....... 

Tanuj Kumar:
20150626 13:46:50
Can someone please tell whether it is possible for the SPOJ compiler to judge wrongly. Because my code worked fine on idone.com but it shows wrong answer here. P.S. My code is in C.


uptoyou:
20150624 11:03:43
hint : stack is used for the implementation 

uptoyou:
20150624 11:00:45
yeah AC in one go after thinking the algorithm about 1 hour haha, anyway, nice problem :) 

vasayashwanth:
20150618 03:43:07
i used cin.getline() to read the input and got WA too many times......and then used cin>> and got AC.....also check that array size is atleast 400
