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