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.Text;
- using System.Threading.Tasks;
- namespace _01.Phonebook
- {
- class Program
- {
- static void Main(string[] args)
- {
- var contacts = new Dictionary<string, string>();
- while (true)
- {
- var input = Console.ReadLine().Split(' ');
- if (input[0] == "A")
- {
- contacts.Add(input[1], input[2]);
- }
- else if (input[0] == "S")
- {;
- if (contacts.ContainsKey(input[1]))
- {
- Console.WriteLine($"{input[1]} -> {contacts[input[1]]}");
- }
- else
- {
- Console.WriteLine($"Contact {input[1]} does not exist.");
- }
- }
- if (input[0] == "END")
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement