P14499 [GeeksforGeeks] Prefix to infix conversion
普及
题目描述

You are given a string S of size N that represents the prefix form of a valid mathematical expression. Convert it to its infix form.
Example 1:
Input:
-A/BC-/AKL
Output:
((A-(B/C))
((A/K)-L))
Explanation:
The above output is its valid infix form.
Your Task:
Complete the function string preToInfix(string pre_exp), which takes a prefix string as input and return its infix form.

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

输入格式

见题面

输出格式

见题面

样例输入
*-A/BC-/AKL
样例输出
((A-(B/C))*((A/K)-L))