Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- List<string> list = Console.ReadLine().Split(", ").ToList();
- List<string> command = Console.ReadLine().Split(" - ").ToList();
- while (command[0] != "Craft!")
- {
- string commandName = command[0];
- string value = command[1];
- if (commandName == "Collect")
- {
- if (!(list.Contains(value)))
- {
- list.Add(value);
- }
- }
- else if (commandName == "Drop")
- {
- if (list.Contains(value))
- {
- list.Remove(value);
- }
- }
- else if (commandName == "Renew")
- {
- if (list.Contains(value))
- {
- string temp = command[1];
- list.Remove(value);
- list.Add(temp);
- }
- }
- else if (commandName == "Combine Items")
- {
- List<string> combine = value.Split(':').ToList();
- string oldItem = combine[0];
- string newItem = combine[1];
- if (list.Contains(oldItem))
- {
- int index = list.IndexOf(oldItem);
- int newIndex = index + 1;
- list.Insert(newIndex, newItem);
- }
- }
- command = Console.ReadLine().Split(" - ").ToList();
- }
- Console.WriteLine(string.Join(", ", list));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement