Advertisement
GabrielDas

Untitled

Feb 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace P03HouseParty
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14.  
  15. List<string> guests = new List<string>();
  16. int count = int.Parse(Console.ReadLine());
  17.  
  18. for(int i = 0; i < count; i++)
  19. {
  20. string[] command = Console.ReadLine().Split();
  21.  
  22. if (command.Length == 3)
  23. {
  24. if (!guests.Contains(command[0]))
  25. {
  26. guests.Add(command[0]);
  27. }
  28. else
  29. {
  30. Console.WriteLine($"{command[0]} is already in the list!");
  31. }
  32. }
  33. else if (command.Length==4)
  34. {
  35. if (guests.Contains(command[0]))
  36. {
  37. guests.Remove(command[0]);
  38. }
  39. else
  40. {
  41. Console.WriteLine($"{command[0]} is not in the list!");
  42. }
  43. }
  44. }
  45.  
  46. foreach(var item in guests)
  47. {
  48. Console.WriteLine(item);
  49. }
  50.  
  51. }
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement