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 phoneBook
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] phoneNumbers = Console.ReadLine().Split(' ');
- string[] names = Console.ReadLine().Split(' ');
- string[] ownNames = new string[names.Length];
- var index = 0;
- string[] indexInNames = new string[names.Length];
- var run = true;
- while (run)
- {
- var input = Console.ReadLine();
- if (input == "done")
- {
- run = false;
- }
- ownNames[index] = input;
- index++;
- }
- for (int i = 0; i < names.Length; i++)
- {
- for (int y = 0; y < ownNames.Length; y++)
- {
- if (names[i] == ownNames[y])
- {
- indexInNames[i] = i.ToString();
- }
- }
- }
- for (int i = 0; i < indexInNames.Length; i++)
- {
- if(indexInNames[i] != null)
- {
- Console.WriteLine(names[i] + " -> " + phoneNumbers[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement