User:Sridharinfinity/Programming Contests/Sphere Source/4
Appearance
# 4. Transform the Expression # Problem code: ONP def term(expr): if expr[0].isalpha(): return expr[0], expr[1:] t, e = rpn(expr[1:]) return t,e[1:] def rpn(expr): t1, e = term(expr) if e == '': return t1,'' o = e[0] t2, e = term(e[1:]) return t1+t2+o,e nr = int(raw_input()) for _ in range(nr): expr = raw_input() pn,x = rpn(expr) print pn