Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

Given a string prefix expression, convert it to the corresponding postfix expression.

  • A prefix expression is one where the operator precedes its operands. For example, "*+AB-CD" corresponds to the infix expression "(A+B) * (C-D)".
  • A postfix expression is one where the operator follows its operands. For example, "AB+CD-*" corresponds to the same infix expression "(A+B) * (C-D)".
Test Cases
Input
Output
Expected