You are keeping the scores for a baseball game with strange rules. You begin with an empty record, and you are given a list of operations operations to apply, where operations[i] is one of:
- An integer
x(as a string): record a new score ofx. "+": record a new score that is the sum of the previous two scores."D": record a new score that is double the previous score."C": invalidate the previous score, removing it from the record.
Return the sum of all the scores on the record after applying all the operations. All operations are guaranteed to be valid at the moment they are applied.