fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8.  
  9.  
  10. public static void Main()
  11. {
  12. string[] array1 = new[] { "100101","100102" ,"100101","100104","100101" };
  13. string[] array2 = new[] { "Testing123", "Apple123", "Dog123","Cat123", "Animal123" };
  14.  
  15. var strings = array1.Select((s,index) => new{ s, index })
  16. .GroupBy(x => x.s)
  17. .Select(g =>
  18. string.Join(" ", g.Select(x => array2.ElementAtOrDefault(x.index)).ToArray()));
  19.  
  20. foreach(string s in strings)
  21. Console.WriteLine(s);
  22. }
  23. }
Success #stdin #stdout 0.04s 34048KB
stdin
Standard input is empty
stdout
Testing123 Dog123 Animal123
Apple123
Cat123