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
khasrulalam:
2020-06-12 06:20:16
no need deep thinking |
|
hello_1234:
2020-06-04 15:14:59
can anyone one explain this problem!! |
|
wangyuxiangorz:
2020-05-26 15:25:01
AC in 1 go! yay! |
|
adityaguptagkp:
2020-05-20 22:12:14
ac in one go...
|
|
sacsachin:
2020-05-12 06:06:28
AC in one go :) |
|
dassatyaki:
2020-05-07 18:07:04
Use stack.
|
|
amit_dubey99:
2020-05-06 14:25:30
so freakin easy! AC in one GO! |
|
pharoaheye:
2020-04-30 13:38:44
Ac in one go .... so easy
|
|
sakibmalik:
2020-04-20 08:37:40
Used wrong language for submitting, otherwise first time AC and even that in less than 15 min. |
|
demonhue:
2020-03-21 15:25:43
didn't know how to solve using stacks so solved using vector pair ;) |
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: | - |
Problem's scores 1 vote
Concept difficulty
Implementation difficulty
265
7