03. Inventory - MidExam - C# Fundamentals
Здравейте,
Бихте ли ми помогнали със задачата. Предварително благодаря!
Това е кода ми: https://pastebin.com/gc0v7YsJ
Ето го условието:
Problem 3. Inventory
As a young traveler, you gather items and craft new items.
Input / Constraints
You will receive a journal with some Collecting items, separated with ', ' (comma and space). After that, until receiving "Craft!" you will be receiving different commands.
Commands (split by " - "):
- "Collect - {item}" – Receiving this command, you should add the given item in your inventory. If the item already exists, you should skip this line.
- "Drop - {item}" – You should remove the item from your inventory, if it exists.
- "Combine Items - {oldItem}:{newItem}" – You should check if the old item exists, if so, add the new item after the old one. Otherwise, ignore the command.
- "Renew – {item}" – If the given item exists, you should change its position and put it last in your inventory.
Output
After receiving "Craft!" print the items in your inventory, separated by ", " (comma and space).
Examples
Input |
Output |
Iron, Wood, Sword Collect - Gold Drop - Wood Craft! |
Iron, Sword, Gold |
Input |
Output |
Iron, Sword Drop - Bronze Combine Items - Sword:Bow Renew - Iron Craft! |
Sword, Bow, Iron |
Thanks!
It was just the space after comma and I got 100/100.