#C2548. Inventory Management

    ID: 45876 Type: Default 1000ms 256MiB

Inventory Management

Inventory Management

You are given a sequence of transactions to manage an inventory of books identified by their ISBN numbers. Each transaction is in one of two formats: add ISBN or remove ISBN. For an add transaction, add the ISBN to the inventory. For a remove transaction, if the ISBN exists in the inventory, remove it; otherwise, print an error message.

Note that the inventory acts as a set, so adding the same ISBN multiple times only stores one instance, and a remove operation only removes an ISBN if it exists.

inputFormat

The first line of input contains an integer T representing the number of transactions. Each of the following T lines contains a transaction in the format: "add ISBN" or "remove ISBN".

outputFormat

For each remove transaction that attempts to remove an ISBN that is not present in the inventory, output a line containing the word "error". If there are no error messages, output nothing.## sample

6
add 9783161484100
add 9781234567897
remove 9783161484100
remove 9783161484100
remove 9783161484101
add 9783161484100
error

error

</p>