Standard Bar Stack and Queues · Infix, Postfix, and Prefix O(n) · O(n)
A calculator firmware evaluates expressions on a stack machine that wants operators after their operands, yet engineers type expressions the human way with operators in between and parentheses overriding precedence. The firmware's translation desk rewrites each expression so that `a + b` becomes `a b +` while honoring that `^` outranks `*` and `/`, which outrank `+` and `-`.
Input: A string expression in infix form using single alphanumeric operands, the operators + - * / ^, and parentheses.
Output: Return the equivalent postfix (Reverse Polish) expression as a string.
1 <= expression.length <= 10^5Operands are single letters or digitsPrecedence order: ^ > * = / > + = -Input: {"expression":"a+b*(c^d-e)^(f+g*h)-i"}
Output: "abcd^e-fgh*+^*+i-"
Parenthesized sub-expressions are resolved first, then multiplication/addition levels unwrap per precedence.
Input: {"expression":"A*(B+C)/D"}
Output: "ABC+*D/"
B+C emits first; * then / follow, and equal precedence pops left-to-right.