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 Dict_Lambda_LINQ___Exercise___15._10._2017
- {
- class PhoneBook
- {
- static void Main(string[] args)
- {
- string[] splittedCommand = Console.ReadLine().Trim().Split(' ');
- Dictionary<string, string> phonebook = new Dictionary<string, string>();
- while (splittedCommand[0] != "END")
- {
- if (splittedCommand[0] == "A")
- {
- phonebook[splittedCommand[1]] = splittedCommand[2];
- }
- else if (splittedCommand[0] == "S")
- {
- if (phonebook.ContainsKey(splittedCommand[1]))
- {
- Console.WriteLine(phonebook[splittedCommand[1]] + "->" + splittedCommand[2]);
- }
- else
- {
- Console.WriteLine("Contact {0} does not exist.", splittedCommand[1]);
- }
- }
- splittedCommand = Console.ReadLine().Split(' ');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement