petarkobakov

SoftUni party

Oct 1st, 2020 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace SoftUni_Party
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. string input = Console.ReadLine();
  11. HashSet<string> VIPguests = new HashSet<string>();
  12. HashSet<string> REGULARguests = new HashSet<string>();
  13. int count = 0;
  14.  
  15. while (input!="PARTY")
  16. {
  17. string reservation = input;
  18.  
  19. if (char.IsDigit(reservation[0]))
  20. {
  21. VIPguests.Add(reservation);
  22. }
  23.  
  24. else
  25. {
  26. REGULARguests.Add(reservation);
  27. }
  28.  
  29. count++;
  30. input = Console.ReadLine();
  31. }
  32.  
  33. string newInput = Console.ReadLine();
  34.  
  35. while (newInput != "END")
  36. {
  37. string guest = newInput;
  38.  
  39. if (VIPguests.Contains(guest))
  40. {
  41. VIPguests.Remove(guest);
  42. count--;
  43. }
  44.  
  45. else if (REGULARguests.Contains(guest))
  46. {
  47. REGULARguests.Remove(guest);
  48. count--;
  49. }
  50.  
  51. newInput = Console.ReadLine();
  52. }
  53.  
  54. Console.WriteLine(count);
  55.  
  56. foreach (var guest in VIPguests)
  57. {
  58. Console.WriteLine(guest);
  59. }
  60.  
  61. foreach (var guest in REGULARguests)
  62. {
  63. Console.WriteLine(guest);
  64. }
  65.  
  66. }
  67. }
  68. }
  69.  
Advertisement
Add Comment
Please, Sign In to add comment