逆波兰就是后序
输入:tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]
输出:22
def evalRPN(self, tokens):
stack = []
for token in tokens:
if token == '+':
stack.append(int(stack.pop() + stack.pop()))
elif token == '-':
stack.append(int(-1 * stack.pop() + stack.pop()))
elif token == '*':
stack.append(int(stack.pop() * stack.pop()))
elif token == '/':
denometor = stack.pop()
stack.append(int(stack.pop() / denometor))
else:
stack.append(int(token))
return stack.pop()