Advertisement
gabi11

Sets & Dictionaries Advanced - 5. Record Unique Names

May 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 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.  
  7. namespace Advanced
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var names = new HashSet<string>();
  14.  
  15.             int number = int.Parse(Console.ReadLine());
  16.  
  17.             for (int i = 0; i < number; i++)
  18.             {
  19.                 var name = Console.ReadLine();
  20.                 names.Add(name);
  21.             }
  22.  
  23.             foreach (var name in names)
  24.             {
  25.                 Console.WriteLine(name);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement