s=input() stack=[0]* len(s);top=- 1;presign='+';num=0 for i in range(len(s)): if'0'<=s[i]<='9': num=num*10+int(s[i]) if i==len(s)- 1 or s[i] in'+-*/': if presign=='+': top+=1 stack[top]=num elifpresign=='-': top+=1 stack[top]=-num elifpresign=='*': top+=1 stack[top]=stack[top- 1]*num else: top+=1 stack[top]=stack[top- 1]//num presign=s[i] num=0 print(sum(stack)) #sum 函数对 stack 中所有元素求和 |
若输入'5*4-6+10/3' ,程序运行后, 输出结果是( )