Advertisement
Ina5

FixEmails

Oct 10th, 2016
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 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 _4FixEmails
  8. {
  9.     class _4FixEmails
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string name = Console.ReadLine();
  14.             Dictionary<string, string> emails = new Dictionary<string, string>();
  15.             while (name != "stop")
  16.             {
  17.                 string email = Console.ReadLine();
  18.                 string subEmail = email.Substring(email.Length - 2);
  19.                 if (subEmail != "us" && subEmail != "uk")
  20.                 {
  21.                     emails.Add(name, email);
  22.                 }
  23.                 else
  24.                 {
  25.                     name = Console.ReadLine();
  26.                 }
  27.                 name = Console.ReadLine();
  28.             }
  29.             foreach (KeyValuePair<string, string> kvp in emails)
  30.             {
  31.  
  32.                 Console.WriteLine("{0} -> {1}", kvp.Key, kvp.Value);
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement