#K13791. Unique Products Count in Warehouse
Unique Products Count in Warehouse
Unique Products Count in Warehouse
You are given a warehouse that initially is empty. You will receive a series of queries to either add a product or delete a product from the warehouse. Each query is in one of the following formats: ADD x
or DELETE x
, where \(x\) is an integer representing the product ID.
When an ADD
operation is performed, the product \(x\) is added to the warehouse. When a DELETE
operation is performed, if the product \(x\) exists in the warehouse, it is removed; otherwise, nothing happens.
Your task is to compute the number of unique products remaining in the warehouse after all the queries have been processed.
Note: The uniqueness of a product is determined by its id, and duplicate additions do not increase the count.
inputFormat
The input begins with an integer \(n\) indicating the number of queries. The following \(n\) lines each contain one query in the form "ADD x" or "DELETE x".
outputFormat
Output a single integer representing the number of unique products remaining in the warehouse.
## sample4
ADD 1
ADD 2
ADD 3
ADD 4
4