Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace P7_FixEmails
- {
- class Program
- {
- static void Main()
- {
- string name = Console.ReadLine();
- SortedDictionary<string, string> dict = new SortedDictionary<string, string>();
- while (name != "stop")
- {
- string email = Console.ReadLine().Trim();
- string endOfEmail = email.Substring(email.Length - 2, 2).ToLower();
- if (endOfEmail != "us" && endOfEmail != "uk")
- {
- if (!dict.ContainsKey(name))
- {
- dict.Add(name, email);
- }
- else
- {
- dict[name] = email;
- }
- }
- name = Console.ReadLine();
- }
- foreach (var item in dict)
- {
- Console.WriteLine($"{item.Key} -> {item.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment