Standard Bar Stack and Queues · Infix, Postfix, and Prefix O(n) · O(n)
A billing engine feeds expressions to a mainframe whose dialect writes operators *before* their operands (`+ a b` instead of `a + b`). The conversion desk has a trick: read the expression right-to-left, swap the parenthesis roles, and let the same precedence machinery run — then flip the assembled result to restore reading order. Implement that desk.
Input: A string expression in infix form using single alphanumeric operands, the operators + - * / ^, and parentheses.
Output: Return the equivalent prefix (Polish) expression as a string.
1 <= expression.length <= 10^5Operands are single letters or digitsPrecedence order: ^ > * = / > + = -Input: {"expression":"((A-(B/C))*((A/K)-L))"}
Output: "*-A/BC-/AKL"
The fully parenthesized input converts unambiguously; reading backwards then reversing produces the operator-first form.
Input: {"expression":"A+B*C"}
Output: "+A*BC"
Multiplication binds tighter, so the addition ends up as the outermost operator.