#C11149. Processing Word Store Commands
Processing Word Store Commands
Processing Word Store Commands
In this problem, you are provided with a series of text commands that manipulate a store of unique words. The commands are entered via standard input. There are three types of commands:
- (\texttt{ADD }): Add the word to the store. If the word already exists, do nothing.
- (\texttt{REMOVE }): Remove the word from the store if it exists.
- (\texttt{COUNT}): Output the current number of unique words in the store.
The input starts with an integer (N) representing the total number of commands. Following this, there are (N) lines with one command per line. For every (\texttt{COUNT}) command, print the size of the store on a new line. Make sure your solution handles commands sequentially and performs the required operations correctly.
inputFormat
The first line of input contains an integer (N) ((1 \leq N \leq 10^5)) representing the total number of commands. Each of the following (N) lines contains one command in one of the following formats:
- (ADD )
- (REMOVE )
- (COUNT)
It is guaranteed that will be a non-empty string without spaces.
outputFormat
For every (COUNT) command encountered in the input, output a single line containing the number of unique words currently in the store.## sample
2
ADD apple
COUNT
1
</p>