Advertisement
martinvalchev

Fix_Emails

Feb 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 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 Fix_Emails
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Dictionary<string, string> email = new Dictionary<string, string>();
  14.  
  15.             string name;
  16.  
  17.             while ((name = Console.ReadLine()) != "stop")
  18.             {
  19.                 string inputEmail = Console.ReadLine();
  20.  
  21.                 if (!(inputEmail.EndsWith(".us") || inputEmail.EndsWith(".uk")))
  22.                 {
  23.                     if (!email.ContainsKey(name))
  24.                     {
  25.                         email.Add(name, "");
  26.                     }
  27.                     email[name] = inputEmail;
  28.                 }
  29.             }
  30.             foreach (var item in email)
  31.             {
  32.                 Console.WriteLine($"{item.Key} -> {item.Value}");
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement