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
shyam55555:
20160202 11:57:58
Succeed.. But seems like i took long time.. almost 3 hours.. Is this a problem with me only? :) 

imshubhamk:
20160126 17:57:41
got ac in first attempt.....


rajanbitp:
20160121 14:08:24
hurrah, got AC in first Attempt. 

rahul_verma:
20160120 14:35:49
feeling relaxed after doing this problem 

thevillager:
20160120 13:02:41
For all those who are getting " SIGSEGV " error . Make change in your input. Try changing it to " string "data type or make your array size bigger


iamareebjamal:
20160113 11:47:36
Runs perfectly on ideone.com


cherag_0001:
20160104 08:32:29
whooo hoo !! 2nd try ..// in the first try just an "endl" missing :P 

skrishna99:
20151231 10:41:16
I got RTE(NZec) I tried all known options to me , finally identified that I have not pushed "" to stack . Pretty easy problem using stacks.


ashu14:
20151227 15:51:29
@yeahboy this type is not allowed.. As it can have multiple rpn forms possible! 

motasem mohammad:
20151225 14:10:18
taught me how to use stack function , a good problem 
Added by:  Michał Małafiejski 
Date:  20040501 
Time limit:  5s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL 6 VB.net 
Resource:   