Advertisement
Guest User

Emails

a guest
May 21st, 2016
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _07.FixEmails
  5. {
  6.     class FixEmails
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string name = Console.ReadLine();
  11.             Dictionary<string, string> emails = new Dictionary<string, string>();
  12.             while (name != "stop")
  13.             {
  14.                 string email = Console.ReadLine();
  15.                 string ending = email.Substring(email.Length - 2, 2).ToLower();
  16.                 if (ending != "uk" && ending != "us")
  17.                 {
  18.                     emails.Add(name, email);
  19.                 }
  20.                 name = Console.ReadLine();
  21.             }
  22.             foreach (var pair in emails)
  23.             {
  24.                 Console.WriteLine("{0} -> {1}", pair.Key, pair.Value);
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement