PBLM code: INPSTFIX
i m getting nzec error in codecheff idle but it is working fine in my idle.please help
cook your dish here
for t in range(int(input())):
n=int(input())
s=input()
new=“”
ind=[‘^’,‘*’,‘/’,‘+’,‘-’]
p=0
stack=[]
for i in range(0,len(s)):
if(ord(s[i])>=65 and ord(s[i])<=90):
new+=s[i]
else:
if s[i]==')':
element=stack.pop(len(stack)-1)
while(len(stack)>0 and element!='('):
new+=element
element=stack.pop(len(stack)-1)
else:
if(s[i]=='('):
stack.append(s[i])
else:
while(len(stack)>0 and stack[len(stack)-1]!='(' and ind.index(stack[len(stack)-1])<ind.index(s[i])):
new+=stack.pop(len(stack)-1)
stack.append(s[i])
while(len(stack)!=0):
new+=stack.pop(len(stack)-1)
print(new)