fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var A = new[] {"1","2","3"};
  10.  
  11. var B = new[] {
  12. "1,2,3,4,5,6,7",
  13. "1,2,6,7",
  14. "1",
  15. "4,5,6",
  16. "6,7"
  17. };
  18.  
  19. var matches = B.Where(s => s.Split(',').Intersect(A).Any()).ToList();
  20. foreach(var match in matches) Console.WriteLine(match);
  21.  
  22. }
  23. }
Success #stdin #stdout 0.03s 34048KB
stdin
Standard input is empty
stdout
1,2,3,4,5,6,7
1,2,6,7
1