Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace PhoneBook
- {
- using System;
- using System.Collections.Generic;
- public class Startup
- {
- public static void Main()
- {
- string input;
- Dictionary<string, string> phoneBook = new Dictionary<string, string>();
- while ((input = Console.ReadLine()) != "END")
- {
- string[] inputArgs = input
- .Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
- if (inputArgs.Length == 3)
- {
- phoneBook[inputArgs[1]] = inputArgs[2];
- continue;
- }
- Console.WriteLine(phoneBook.ContainsKey(inputArgs[1]) ? $"{inputArgs[1]} -> {phoneBook[inputArgs[1]]}" : $"Contact {inputArgs[1]} does not exist.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement