try:
test_cases = int(input())
for z in range(test_cases):
n = int(input())
memory = list(input())
print(z)
stack = ["("]
postfix = []
prefence = {"*": 2, "/": 2, "+": 1, "-": 1, "^": 3}
brakets = ["(", ")"]
def infixpsotfix(element):
for element in memory:
if element not in brakets and element not in prefence:
postfix.append(element)
elif element in prefence or element in brakets:
if element in prefence:
if stack[-1] in prefence and prefence[stack[-1]] < prefence[element] and element in prefence:
stack.append(element)
elif stack[-1] in prefence and prefence[stack[-1]] >= prefence[element]:
poped = stack.pop()
stack.append(element)
postfix.append(poped)
else:
stack.append(element)
if element in brakets and element == "(":
stack.append(element)
elif element in brakets and stack[-1] == "(":
pass
elif element in brakets and element == ")":
for i in range(len(stack)):
pope = stack.pop()
if pope != "(":
postfix.append(pope)
else:
break
infixpsotfix(memory)
for ii in range(len(stack)):
if stack[len(stack)-ii-1] == "(":
break
else:
postfix.append(stack[len(stack)-ii-1])
print("".join(postfix))
except:
pass
this is my Code Please any one Tell me Why WA