Advertisement
bacco

Fix Emails

Jun 8th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6. namespace FixEmails
  7. {
  8.     class MainClass
  9.     {
  10.         public static void Main(string[] args)
  11.         {
  12.             var mailBook = new Dictionary<string, string>();
  13.             string name = "";
  14.             string mail = "";
  15.             string commands =Console.ReadLine();
  16.  
  17.             while (commands != "stop")
  18.             {
  19.                 name = commands;
  20.                 mail = Console.ReadLine();
  21.                 if (!mailBook.ContainsKey(name))
  22.                 {
  23.                     mailBook.Add(name, mail);
  24.                 }
  25.                 commands = Console.ReadLine();
  26.             }
  27.             foreach (var pair in mailBook
  28.                      .Where(x => !x.Value.EndsWith(".us") &&
  29.                                  !x.Value.EndsWith(".uk")
  30.                            )
  31.                     )
  32.             {
  33.                 Console.WriteLine($"{pair.Key} -> {pair.Value}");
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement