Solution
C++ []\nclass Solution {\npublic:\n    int calPoints(vector<string>&o)\n    {\n        stack<int>s;\n        for(int i=0;i<o.size();i++)\n        {\n           
```C++ []\nclass Solution {\npublic:\n    int calPoints(vector<string>&o)\n    {\n        stack<int>s;\n        for(int i=0;i<o.size();i++)\n        {\n            if(o[i]=="C")\n            s.pop();\n            else if(o[i]=="D")\n            s.push(s.top()*2);\n            else if(o[i]=="+")\n            {\n                int e1=s.top();\n                s.pop();\n                int e2=s.top();\n                s.push(e1);\n                s.push(e1+e2);\n            }\n            else\n            s.push(stoi(o[i]));\n        }\n        int sum=0;\n        while(!s.empty())\n        {\n        sum+=s.top();\n        s.pop();\n        }\n        return sum;\n    }\n};\n```\n\n```Python3 []\nclass Solution:\n    def calPoints(self, operations: List[str]) -> int:\n        stack = []\n\n        for c in operations:\n            if c == "C":\n                stack.pop()\n            elif c == "D":\n                stack.append(stack[-1] * 2)\n            elif c == "+":\n                stack.append(stack[-1] + stack[-2])\n            else:\n                stack.append(int(c))\n        return sum(stack)\n```\n\n```Java []\nclass Solution {\n    public int calPoints(String[] operations) {\n    int sum=0;\n    int[] arr = new int[operations.length];\n    int count=0;\n\n    for(int i=0;i<operations.length;i++){\n        if(operations[i].equals("C")){\n            arr[--count]=0;\n        }\n        else if(operations[i].equals("D")){\n            arr[count] = 2 * arr[count-1];\n            count++;\n        }\n        else if(operations[i].equals("+")){\n            arr[count]= arr[count-1] + arr[count-2];\n            count++;\n        } else {\n            arr[count] = Integer.parseInt(operations[i]);\n            count++;\n        }   \n    }\n    for(int j=0;j<arr.length;j++){\n        sum += arr[j];\n    }\n    return sum;\n    }\n}\n```\n
['C++', 'Java', 'Python3']