Advertisement
gabi11

Sets & Dictionaries Advanced - 7. SoftUni Party

May 19th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7.  
  8. namespace Advanced
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             var VIP = new HashSet<string>();
  15.             var regular = new HashSet<string>();
  16.  
  17.             var pattern = @"^[0-9][\w]+";
  18.  
  19.             var input = Console.ReadLine();
  20.  
  21.  
  22.             while (input != "PARTY")
  23.             {
  24.                 if (Regex.IsMatch(input, pattern))
  25.                 {
  26.                     VIP.Add(input);
  27.                 }
  28.  
  29.                 else
  30.                 {
  31.                     regular.Add(input);
  32.                 }
  33.  
  34.                 input = Console.ReadLine();
  35.             }
  36.  
  37.             input = Console.ReadLine();
  38.  
  39.             while (input != "END")
  40.             {
  41.                 if (VIP.Contains(input))
  42.                 {
  43.                     VIP.Remove(input);
  44.                 }
  45.  
  46.                 else
  47.                 {
  48.                     regular.Remove(input);
  49.                 }
  50.                 input = Console.ReadLine();
  51.             }
  52.  
  53.             Console.WriteLine(VIP.Count + regular.Count);
  54.  
  55.             foreach (var guest in VIP)
  56.             {
  57.                 Console.WriteLine(guest);
  58.             }
  59.  
  60.             foreach (var guest in regular)
  61.             {
  62.                 Console.WriteLine(guest);
  63.             }
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement