Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- Dictionary<string, string> phonebook = new Dictionary<string, string>();
- string[] command = Console.ReadLine().Split();
- while (!command.Contains("END"))
- {
- if (command.Contains("A"))
- {
- phonebook[command[1]] = command[2];
- }
- else if (command.Contains("S"))
- {
- if (phonebook.Keys.Contains(command[1]))
- {
- Console.WriteLine("{0} -> {1}", command[1], phonebook[command[1]]);
- }
- else
- {
- Console.WriteLine("Contact {0} does not exist.",command[1]);
- }
- }
- command = Console.ReadLine().Split();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement