ONP - Transform the Expression
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.
Input: 3 (a+(b*c)) ((a+b)*(z+x)) ((a+t)*((b+(a+c))^(c+d))) Output: abc*+ ab+zx+* at+bac++cd+^*
weak test cases
i'am getting ac on codechef but wrong answer on spoj can any one help?
Nice..Solved it using structures instead of stack<>..feels good.
I tried using strings and my program pass in test cases. But its failing when submitting. The outputs are also printed in new line. What can be the reason? pl post any test cases. Its failing in codechef also
Last edit: 2017-04-27 07:00:48
I used to think this problem is complicated, but it's effin' easy!
nice problem :D
AC in one go.
AC in One without stack :D My first AC in one! ^_^ time taken: 0.00 :PLast edit: 2017-03-17 17:56:37
AC in one go :)
|Cluster:||Cube (Intel G860)|
|Languages:||All except: NODEJS PERL6 VB.NET|