using System;
public class Program
{
public static void Main()
char[] arr={'a','b','c','d'};
for(int i = 1; i < 4; i++)
foo(arr, string.Empty, i);
}
static void foo(char[] arr, string s, int len)
if (s.Length == len)
Console.WriteLine(s);
return;
for (int i = 0; i < arr.Length; i++)
string t = s;
t += arr[i];
foo(arr, t, len);