LearnPy Hub
← Dictionaries problems
Hard

Inventory

Start with an empty inventory. Read n commands: add item k or remove item k (never below 0; stop at 0). Then print the items with a count above 0 in alphabetical order as item k, or Empty.

Input

n, then n commands.

Output

The final inventory.

Sample 1

Input
3
add pen 5
add book 2
remove pen 3
Output
book 2
pen 2

Sample 2

Input
2
add a 1
remove a 5
Output
Empty
solution.py
Output appears here
Inventory · Python practice problem · LearnPy Hub