Advertisement
YavorGrancharov

Fix_Emails(dict)

Oct 17th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 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.             string name = Console.ReadLine();
  14.  
  15.             Dictionary<string, string> data = new Dictionary<string, string>();
  16.  
  17.             while (name != "stop")
  18.             {
  19.                 string email = Console.ReadLine();
  20.  
  21.                 if (!data.ContainsKey(name))
  22.                 {
  23.                     data.Add(name, email);
  24.                 }
  25.                 data[name] = email;
  26.  
  27.                 name = Console.ReadLine();
  28.             }
  29.  
  30.             foreach (var record in data.Where(x => !x.Value.Contains("us") || !x.Value.Contains("uk")))
  31.             {
  32.                 Console.WriteLine("{0} -> {1}", record.Key, record.Value);
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement