Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace phoneBook
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. string[] phoneNumbers = Console.ReadLine().Split(' ');
  15. string[] names = Console.ReadLine().Split(' ');
  16. string[] ownNames = new string[names.Length];
  17. var index = 0;
  18. string[] indexInNames = new string[names.Length];
  19. var run = true;
  20. while (run)
  21. {
  22. var input = Console.ReadLine();
  23. if (input == "done")
  24. {
  25. run = false;
  26. }
  27. ownNames[index] = input;
  28. index++;
  29. }
  30.  
  31. for (int i = 0; i < names.Length; i++)
  32. {
  33. for (int y = 0; y < ownNames.Length; y++)
  34. {
  35. if (names[i] == ownNames[y])
  36. {
  37. indexInNames[i] = i.ToString();
  38. }
  39. }
  40. }
  41.  
  42. for (int i = 0; i < indexInNames.Length; i++)
  43. {
  44. if(indexInNames[i] != null)
  45. {
  46. Console.WriteLine(names[i] + " -> " + phoneNumbers[i]);
  47. }
  48. }
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement