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).
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
happy:
2016-04-09 08:18:26
at last....feeling relaxed
|
|
nischaymalhan:
2016-03-22 22:39:45
Didn't leave a line after printing output for different test cases... Got stuck for more than an hour... Tragedy of Coding xD |
|
pica_power:
2016-03-09 17:29:33
Got AC in first attemept.. :)
|
|
last_mohican:
2016-03-07 22:39:58
Wrong answer?! How can I see where? |
|
geekahmed:
2016-03-05 17:39:07
it gives me segmentation fault , but when I run it on my pc
|
|
shyam55555:
2016-02-02 11:57:58
Succeed.. But seems like i took long time.. almost 3 hours.. Is this a problem with me only? :-) |
|
imshubhamk:
2016-01-26 17:57:41
got ac in first attempt.....
|
|
rajanbitp:
2016-01-21 14:08:24
hurrah, got AC in first Attempt. |
|
rahul_verma:
2016-01-20 14:35:49
feeling relaxed after doing this problem |
|
thevillager:
2016-01-20 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
|
Added by: | mima |
Date: | 2004-05-01 |
Time limit: | 5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 VB.NET |
Resource: | - |