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
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.....
easy problem

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
like char a[400]. Had the same problem.

Last edit: 2016-01-20 13:04:19
iamareebjamal: 2016-01-13 11:47:36

Runs perfectly on ideone.com
SIGSEGV here http://ideone.com/iSdEgQ

cherag_0001: 2016-01-04 08:32:29

whooo hoo !! 2nd try ..// in the first try just an "endl" missing :P

skrishna99: 2015-12-31 10:41:16

I got RTE(NZec) I tried all known options to me , finally identified that I have not pushed "-" to stack . Pretty easy problem using stacks.
My first one in stack .

ashu14: 2015-12-27 15:51:29

@yeahboy this type is not allowed.. As it can have multiple rpn forms possible!

motasem mohammad: 2015-12-25 14:10:18

taught me how to use stack function , a good problem

Added by:Michał Małafiejski
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL 6 VB.net

Problem's scores 1 vote

Concept difficulty
Concept difficulty 19%
Implementation difficulty
Implementation difficulty 16%
37 2