Advertisement
tmollov

Untitled

Feb 13th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. Dictionary<string, string> phonebook = new Dictionary<string, string>();
  9. string[] command = Console.ReadLine().Split();
  10. while (!command.Contains("END"))
  11. {
  12. if (command.Contains("A"))
  13. {
  14. phonebook[command[1]] = command[2];
  15. }
  16. else if (command.Contains("S"))
  17. {
  18. if (phonebook.Keys.Contains(command[1]))
  19. {
  20. Console.WriteLine("{0} -> {1}", command[1], phonebook[command[1]]);
  21. }
  22. else
  23. {
  24. Console.WriteLine("Contact {0} does not exist.",command[1]);
  25. }
  26. }
  27. command = Console.ReadLine().Split();
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement