Problem Description

You have an inventory counts dictionary. Commands: ADD item x, REMOVE item x, COUNT item. Missing item starts at 0. REMOVE cannot make count below 0 (stop at 0). For COUNT output current count.

Input Format

First line q. Next q lines commands.

Output Format

Outputs for COUNT.

Sample Test Case

Input:
7 ADD pen 5 REMOVE pen 2 COUNT pen REMOVE pen 10 COUNT pen COUNT book ADD book 1
Output:
3 0 0

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next