java
If you like it pls upvote\n\n\n    public int calPoints(String[] ops) {\n        Stack<Integer> stack = new Stack<>();\n\n        for (int i = 0; i < ops.length
If you like it pls upvote\n```\n\n    public int calPoints(String[] ops) {\n        Stack<Integer> stack = new Stack<>();\n\n        for (int i = 0; i < ops.length; i++) {\n            if (ops[i].equals("C")) {\n                stack.pop();\n            } else if (ops[i].equals("D")) {\n                stack.push(2 * stack.peek());\n            } else if (ops[i].equals("+")) {\n                int a = stack.pop();\n                int res = a + stack.peek();\n                stack.push(a);\n                stack.push(res);\n            } else stack.push(Integer.valueOf(ops[i]));\n        }\n\n        int res = 0;\n\n        while (!stack.isEmpty()) {\n            res += stack.pop();\n        }\n\n        return res;\n    }\n\n```
['Stack', 'Java']