yana_neykovaa

Fix emails code

Oct 19th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 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 demos
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Dictionary<string, string> emails = new Dictionary<string, string>();
  14. bool lol = true;
  15. do
  16. {
  17. string name = Console.ReadLine();
  18. if (name == "stop") { break; }
  19. string email = Console.ReadLine();
  20. emails[name] = email;
  21. int emailLenght = emails[name].Length;
  22. if (emails[name][emailLenght - 1] == 's' && emails[name][emailLenght - 2] == 'u' || emails[name][emailLenght - 1] == 'k' && emails[name][emailLenght - 2] == 'u')
  23. {
  24. emails.Remove(name);
  25. }
  26.  
  27. }
  28. while (lol == true);
  29. foreach (KeyValuePair<string, string> mails in emails) { Console.WriteLine($"{mails.Key} -> {mails.Value}"); }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment