fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. string[] a = { "zeng", "he", "b" };
  10. string[] b = { "ceng", "huo", "b" };
  11. string[] c = { "ceng", "hu", "b" };
  12. string[][] d = { a, b, c };
  13. List<string> r = new List<string>() { "" };
  14. List<string> r1 = new List<string>() { };
  15. for (int i = 0; i < d.Count(); i++)
  16. {
  17. foreach (string s in r)
  18. {
  19. foreach (string[] s1 in d)
  20. {
  21. r1.Add(s + s1[i]);
  22. }
  23. }
  24. r = r1.ToList();
  25. r1.Clear();
  26. }
  27. foreach (string s in r.Distinct())
  28. {
  29. Console.WriteLine(s);
  30. }
  31. }
  32. }
Success #stdin #stdout 0.06s 24136KB
stdin
Standard input is empty
stdout
zengheb
zenghuob
zenghub
cengheb
cenghuob
cenghub