-Annie-

UniqueUsernames

May 26th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. namespace UniqueUsernames
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.  
  6.     public class UniqueUsernames
  7.     {
  8.         public static void Main()
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.             HashSet<string> names = new HashSet<string>();
  12.             string username = Console.ReadLine();
  13.  
  14.             for (int i = 0; i < n; i++)
  15.             {
  16.                 names.Add(username);
  17.                 username = Console.ReadLine();
  18.             }
  19.  
  20.             foreach (string name in names)
  21.             {
  22.                 Console.WriteLine(name);
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment