Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class SoftUniParty
  5. {
  6. public static void Main()
  7. {
  8. HashSet<string> reservations = new HashSet<string>();
  9. HashSet<string> vipReservations = new HashSet<string>();
  10.  
  11. while (true)
  12. {
  13. string input = Console.ReadLine();
  14.  
  15. if (input.ToLower() == "party")
  16. {
  17. break;
  18. }
  19.  
  20. if (input.Length == 8)
  21. {
  22.  
  23. if (!char.IsDigit(input[0]))
  24. {
  25. reservations.Add(input);
  26. }
  27. else
  28. {
  29. vipReservations.Add(input);
  30. }
  31. }
  32.  
  33. }
  34.  
  35.  
  36. while (true)
  37. {
  38. string input = Console.ReadLine();
  39.  
  40. if (input.ToLower() == "end")
  41. {
  42. break;
  43. }
  44.  
  45. if (reservations.Contains(input))
  46. {
  47. reservations.Remove(input);
  48. }
  49.  
  50. if (vipReservations.Contains(input))
  51. {
  52. vipReservations.Remove(input);
  53. }
  54.  
  55. }
  56.  
  57.  
  58. Console.WriteLine(reservations.Count + vipReservations.Count);
  59.  
  60. if (vipReservations.Count > 0)
  61. {
  62. Console.WriteLine(string.Join(Environment.NewLine, vipReservations));
  63. }
  64.  
  65. if (reservations.Count > 0)
  66. {
  67. Console.WriteLine(string.Join(Environment.NewLine, reservations));
  68. }
  69.  
  70.  
  71.  
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement