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;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- List<string> gifts = Console.ReadLine().Split().ToList();
- string[] command = Console.ReadLine().Split().ToArray();
- while (command[0] != "No")
- {
- if (command[0] == "OutOfStock")
- {
- for (int i = 0; i < gifts.Count; i++)
- {
- if (gifts[i].Equals(command[1]))
- {
- gifts[i] = "None";
- }
- }
- }
- if (command[0] == "Required")
- {
- int index = int.Parse(command[2]);
- if (index >= 0 && index < gifts.Count)
- {
- gifts[index] = command[1];
- }
- }
- if (command[0] == "JustInCase")
- {
- gifts[gifts.Count - 1] = command[1];
- }
- command = Console.ReadLine().Split().ToArray();
- }
- gifts.RemoveAll(x => x == "None");
- Console.WriteLine(string.Join(" ", gifts));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement