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.




hide comments
charlles: 2019-04-09 16:14:58

there is an recursive solution to it?

stones: 2019-03-25 19:17:28

AC in One go :P

mohanteja1: 2019-02-16 12:37:43

solved this with recursion

lnediak: 2019-01-27 21:01:15

lol I did rly stupid i didn't use stack i created dumb token class and separate on operator but it works anyways i think maybe logn times slower than stack

traitorakali: 2019-01-08 07:16:03

Why I keep geting runtime error (NZEC) ?

karankeswani99: 2019-01-07 18:58:28

Just use stack

rajulrs13: 2018-12-30 22:10:19

got me stuck for an hour because I took expression length to be 100.. : (

dhuruvapriyan: 2018-12-24 15:46:52

Last edit: 2018-12-24 15:47:23
sehgal_divij: 2018-12-23 13:12:22

Why would my code take 16M Memory to execute?
I used C++ and STL constructs. Is that the reason it took too long to execute?
Would it have been better if I had used just the basic char arrays to perform operations?

Last edit: 2018-12-23 13:13:06
cypher33: 2018-12-19 12:21:17

Got it

Added by:mima
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET

Problem's scores 1 vote

Concept difficulty
Concept difficulty 22%
Implementation difficulty
Implementation difficulty 23%
250 7