Nice Code written in C++ || Must view once and upvote if you like it
\nclass Solution {\npublic:\n    int calPoints(vector<string>& ops) {\n        vector<int> res;\n        for(auto x:ops){\n            if(x=="C"){\n            
```\nclass Solution {\npublic:\n    int calPoints(vector<string>& ops) {\n        vector<int> res;\n        for(auto x:ops){\n            if(x=="C"){\n                res.pop_back();\n            }else if(x=="+"){\n                res.push_back(res.rbegin()[0]+res.rbegin()[1]);\n            }else if(x=="D"){\n                res.push_back(res.back()*2);\n            }else{\n                res.push_back(stoi(x));\n            }\n        }\n        int ans=accumulate(res.begin(),res.end(),0);\n        return ans;\n    }\n};\n```
[]