Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- int numberOfCommands = int.Parse(Console.ReadLine());
- List<string> guests = new List<string>();
- for (int i = 0; i < numberOfCommands; i++)
- {
- string[] arr = Console.ReadLine().Split();
- string name = arr[0];
- string element = arr[2];
- if (element == "going!")
- {
- if (!guests.Contains(name))
- {
- guests.Add(name);
- }
- else
- {
- Console.WriteLine($"{name} is already in the list!");
- }
- }
- else
- {
- if (guests.Contains(name))
- {
- guests.Remove(name);
- }
- else
- {
- Console.WriteLine($"{name} is not in the list!");
- }
- }
- }
- foreach (var guest in guests)
- {
- Console.WriteLine(guest);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement