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