Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace FixEmails
- {
- class Program
- {
- static void Main(string[] args)
- {
- var myDict = new Dictionary<string, string>();
- var result = new Dictionary<string, string>();
- while (true)
- {
- string name = Console.ReadLine();
- if (name.Equals("stop"))
- {
- break;
- }
- if (!myDict.ContainsKey(name))
- {
- myDict.Add(name, "");
- }
- string email = Console.ReadLine().ToLower();
- if (email.Equals("stop"))
- {
- break;
- }
- if (!email.EndsWith(".us") || !email.EndsWith(".uk"))
- {
- myDict[name] = email;
- }
- }
- foreach (KeyValuePair<string, string> kvp in myDict)
- {
- if (kvp.Value.EndsWith("uk") == false
- && kvp.Value.EndsWith("us") == false)
- {
- result.Add(kvp.Key,kvp.Value);
- }
- }
- foreach (KeyValuePair<string, string> kvp in result)
- {
- Console.WriteLine($"{kvp.Key} -> {kvp.Value}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment