P20055 [GeeksforGeeks] Postfix to infix conversion
普及
题目描述

You are given a string that represents the postfix form of a valid mathematical expression. Convert it to its infix form.
Example:
Input:
abc+
Output:
((a
b)+c)
Explanation:
The above output is its valid infix form.
Your Task:
Complete the function string postToInfix(string post_exp), which takes a postfix string as input and returns its infix form.

Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
Constraints:
3<=post_exp.length()<=10^{4}

输入格式

见题面

输出格式

见题面

样例输入
ab*c+
样例输出
((a*b)+c)