Easy C++ Code, beats 80% time
\n Describe your first thoughts on how to solve this problem. \n\n\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity: O(n)\n 
\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int calPoints(vector<string>& operations) {\n        stack<int>s1;\n        int m,n;\n        std::vector<string>::iterator itr=operations.begin();\n            while(1)\n            {\n                if(*itr=="+")\n                {\n                    s1.push(m+n);\n                    m=n;\n                    n=s1.top();\n                }\n                else if(*itr=="D")\n                {\n                    s1.push(2*n);\n                    m=n;\n                    n=2*n;\n                }\n                else if(*itr=="C")\n                {\n                    s1.pop();\n                    n=m;\n                    if(s1.size()>1)\n                    {\n                        s1.pop();\n                        m=s1.top();\n                        s1.push(n);\n                    }\n                }\n                else\n                {\n                    s1.push(stoi(*itr));\n                    m=n;\n                    n=stoi(*itr);\n                }\n                itr++;\n                if(itr==operations.end())\n                    break;\n                //cout<<s1.top()<<endl;\n            }\n            int sum=0;\n            while(!s1.empty())\n            {\n                sum+=s1.top();\n                s1.pop();\n            }\n            return sum;\n    }\n};\n```
['C++']