Given a stack represented as an array and a value x, return how many times x appears in the stack. The input is JSON {stack, x}.
Input: JSON {stack, x}.
Output: Integer — the number of occurrences of x.
Input: {"stack":[1,2,2,3,2],"x":2}
Output: 3
Explanation: 2 appears three times.Input: {"stack":[],"x":5}
Output: 0
Explanation: Empty stack has none.Input: {"stack":[7],"x":7}
Output: 1
Explanation: One occurrence.0<=n<=10^5