LearnPy Hub
← Arena
IntermediateRating 1400

Infix to Postfix

Convert an expression with single-letter operands, + - * / ^ and brackets to postfix (reverse Polish) form. ^ is right-associative and binds tightest; * and / come next; + and - last.

Input

One expression without spaces.

Output

The postfix form.

Sample 1

Input
a+b*(c^d-e)^(f+g*h)-i
Output
abcd^e-fgh*+^*+i-

Sample 2

Input
a+b
Output
ab+
solution.py
Output appears here
Infix to Postfix · Python Arena problem · LearnPy Hub