int evalRPN(vector &tokens) { stack sp; int n = tokens.size(); for (int i = 0; i < n; i++) { if (tokens[i] == "+") { int x = sp.top(); sp.pop(); int y = sp.top(); sp.pop(); sp.push(x + y); } else if (tokens[i] == "-") { int x = sp.top(); sp.pop(); int y = sp.top(); sp.pop(); sp.push(y - x); } else if (tokens[i] == "*") { int x = sp.top(); sp.pop(); int y = sp.top(); sp.pop(); sp.push(x * y); } else if (tokens[i] == "/") { int x = sp.top(); sp.pop(); int y = sp.top(); sp.pop(); sp.push(y / x); } else { sp.push(stoi(tokens[i])); } } return sp.top(); }