Scorekeeper

L4 Easy Stack
Concept
Some problems are really "simulate this with a stack". A run of operations where you must remove the last record is a stack in disguise.
You are scoring a game round by round. The input is a list of strings where each entry is one of: an integer (a score for that round), "C" (remove the previous round's score), "D" (add twice the previous round's score), or "+" (add the sum of the two most recent scores). Return the sum of all scores left at the end.
Examples
▸ ops = ["5", "2", "C", "D", "+"]
→ 30
▸ ops = ["5", "-2", "4", "C", "D", "9", "+", "+"]
→ 27
▸ ops = ["1", "C"]
→ 0
Progressive Hints
Hint 1 · Nudge
The most recent scores are the only ones you ever touch, so keep them in a stack.
Hint 2 · Plan
Keep a stack of the valid scores so far. An integer token pushes that value. 'C' pops the top. 'D' pushes twice the top. '+' pushes the sum of the top two. After all rounds, return the sum of the whole stack.
Hint 3 · Approach
stack = []. For each token: if it's an integer, push it. 'C' pops. 'D' pushes 2 times the top. '+' pushes top plus second-from-top. Return the sum of the stack.
Output
// Run your code to see the output here.