Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Globalization;
- namespace Feb26_2018
- {
- class MainClass
- {
- /* */
- public static void Main()
- {
- //int k = int.Parse(Console.ReadLine());
- //var input = Console.ReadLine()
- // .Split()
- // .Select(double.Parse)
- // .ToList();
- //var firstK = input.Take(k);
- //var asd = input.ToArray().Reverse();
- //Console.WriteLine(asd);
- char[] sep = {' '};
- Dictionary<string, string> peoplesEmailAddresses = new Dictionary<string, string>();
- string personsName;
- string personsEmail;
- while((personsName = Console.ReadLine().ToLower()) != "stop")
- {
- personsEmail = Console.ReadLine();
- peoplesEmailAddresses[personsName] = personsEmail;
- string dotUk = ".uk";
- string dotUS = ".us";
- CultureInfo validate = new CultureInfo("en-US");
- if(personsEmail.EndsWith(dotUk, true, validate) == false || personsEmail.EndsWith(dotUS, true, validate) == false)
- {
- continue;
- }
- if (peoplesEmailAddresses.ContainsKey(personsName))
- {
- peoplesEmailAddresses[personsName] = personsEmail;
- }
- else
- {
- peoplesEmailAddresses.Add(personsName, personsEmail);
- }
- }
- foreach (var contactInfo in peoplesEmailAddresses)
- {
- var name = contactInfo.Key;
- var email = contactInfo.Value;
- Console.WriteLine("{0} -> {1}", name, email);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement