fork(22) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. namespace ConsoleApplication1
  9. {
  10. class Program
  11. {
  12. static char[] A={'a','b','c'};
  13. static int N = 3;
  14. static void foo(string s)
  15. {
  16. if (s.Length == N)
  17. {
  18. Console.WriteLine(s);
  19. return;
  20. }
  21. for (int i = 0; i < A.Length; i++)
  22. {
  23. string t = s;
  24. t += A[i];
  25. foo(t);
  26. }
  27. }
  28.  
  29. static void Main(string[] args)
  30. {
  31. foo("");
  32. }
  33. }
  34. }
  35.  
Success #stdin #stdout 0.04s 23952KB
stdin
Standard input is empty
stdout
aaa
aab
aac
aba
abb
abc
aca
acb
acc
baa
bab
bac
bba
bbb
bbc
bca
bcb
bcc
caa
cab
cac
cba
cbb
cbc
cca
ccb
ccc