Giving a queue and 2 kinds of operations: "E x" means add x to the rear of the queue, "D x" means pop the front x elements of the queue.
14871487
Giving a queue and 2 kinds of operations: "E x" means add x to the rear of the queue, "D x" means pop the front x elements of the queue.
The first line contains an integer \(n (1\leq n\leq 10^5)\). Each of the following n lines is an operation:E x or D x. We guarantee operation D does not empty the queue.
6
E 1
E 2
E 3
D 2
E 1
D 1
3
1