SP20673 CNTINDX - Count The Indexes
Description
Let's deal with an array, the most important data structure of computer science. You will be given some operations to do. There will be three types of operations:
Type 1: Insert a number at the end of the array.
Type 2: Delete the last number of the array, where the last number means the latest number which has been inserted.
Type 3: You will get a number and two indices i & j where i
Input Format
Each file contains one test case. The first line is an integer Q(1
Output Format
For deletion, if the array is already empty, then output a string "invalid" (without quote),otherwise you don't need to print anything for deleting numbers. For the operation type of 2, you have to output an integer, how many times x appears in the array from i to j inclusive.