VickSuna

Untitled

Jun 20th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _2._Exec_03._House_Party
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int n = int.Parse(Console.ReadLine());
  12.  
  13. List<string> guests = new List<string>();
  14.  
  15. string[] command = Console.ReadLine().Split();
  16.  
  17. while (n > 0)
  18. {
  19. string name = command[0];
  20.  
  21. if (command[2] == "going!")
  22. {
  23. if (guests.Contains(name))
  24. {
  25. Console.WriteLine($"{name} is already in the list!");
  26. }
  27. else
  28. {
  29. guests.Add(name);
  30. }
  31. }
  32. else
  33. {
  34. if (guests.Contains(name))
  35. {
  36. guests.Remove(name);
  37. }
  38. else
  39. {
  40. Console.WriteLine($"{name} is not in the list!");
  41. }
  42. }
  43.  
  44.  
  45. n--;
  46.  
  47. command = Console.ReadLine().Split();
  48. }
  49.  
  50.  
  51. Console.WriteLine(String.Join(" ", guests));
  52.  
  53. //for (int i = 0; i < guests.Count; i++)
  54. //{
  55. // Console.WriteLine(guests[i]);
  56. //}
  57.  
  58.  
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment