#include<string.h>
class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param tokens string字符串vector 
     * @return int整型
     */
    int evalRPN(vector<string>& tokens) {
        // write code here
        stack<int> st;
        for(auto& e:tokens)
        {
            if(e=="+" || e=="-" || e=="*" || e=="/")
            {
                int right=st.top();
                st.pop();
                int left=st.top();
                st.pop();
               switch(e[0])
               {
                case('+'):
                st.push(left+right);
                break;
                case('-'):
                st.push(left-right);
                break;
                case('*'):
                st.push(left*right);
                break;
                case('/'):
                st.push(left/right);
                break;
               }
            }
            else
            {
                st.push(stoi(e));
            }
        }
        return st.top();
    }
};