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+^*
|Added by:||Michał Małafiejski|
|Cluster:||Cube (Intel Pentium G860 3GHz)|
|Languages:||All except: NODEJS PERL 6 SCM chicken VB.net|
You will step up from amateur level after solving this
my code went well in ideone.but its not working in this spoj compiler .and i did it in c
where can we get its testing data,
for input a*b*c or a+b+c or a^b^c
Guys, My program works fine ideone. But I get sigsev in SPOJ. I am not sure what is the problem. SPOJ should say for what input it fails. Failing to do that makes it less interesting to continue in SPOJ.
Guys, for the test cases given above my code returns correct results in spite of which I get wrong answer as result. Can anyone please help?
Spent a lot of time fiddling with scanf for strings in ideone. Led to runtime errors.
no need to check precedence.nice problem.learn a lot.
I've been struggling like crazy to get rid of NZEC. I am almost certain that this code (http://ideone.com/********) deals appropriately with all possible statements that may throw exceptions. I think the memory constraint might be the issue here. Would appreciate any help.
It's good that you people know the answer, but don't give the hints here. Let people figure it out and have fun doing it.