Advertisement
braveheart1989

FixEmails

May 12th, 2016
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _08.FixEmails
  8. {
  9.     class FixEmails
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<string> email = new List<string>();
  14.             List<string> names = new List<string>();
  15.             Dictionary<string, string> nameAndEmails = new Dictionary<string, string>();
  16.             string nameOfPerson = Console.ReadLine();
  17.             string emails = string.Empty; ;
  18.  
  19.             while (nameOfPerson != "stop")
  20.             {
  21.                 emails = Console.ReadLine();
  22.                 if (nameOfPerson != "stop" && emails != "stop")
  23.                 {
  24.                     nameAndEmails.Add(nameOfPerson, emails);
  25.                 }
  26.                 else
  27.                 {
  28.                     break;
  29.                 }
  30.                 nameOfPerson = Console.ReadLine();
  31.             }
  32.             Console.WriteLine();
  33.  
  34.             foreach (var name in nameAndEmails.Keys)
  35.             {
  36.                 foreach (var mail in nameAndEmails.Values)
  37.                 {
  38.                     if (/*(!mail.Contains("us") && !mail.Contains("uk")) &&*/ /*(!mail.Contains("US") && !mail.Contains("UK") &&*/
  39.                         !email.Contains(mail) && !names.Contains(name))
  40.                     {
  41.                         Console.WriteLine("{0} -> {1}", name,mail);
  42.                         email.Add(mail);
  43.                         names.Add(name);
  44.                     }
  45.                 }              
  46.             }
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement