using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static string[] data = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"/*, "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" */};
static void Main(string[] args)
{
ArrayList res = new ArrayList();
doit(res);
foreach (string line in res)
{
Console.WriteLine(line);
}
Console.WriteLine();
Console.WriteLine("Count: " + res.Count);
Console.ReadLine();
}
static void next(ArrayList res, string current, int from, int to, int depth, int max_depth)
{
for (int i = from; i < to; i++)
{
if (depth == max_depth)
{
res.Add(current + data[i]);
}
else
{
next(res, current + data[i], i + 1, to, depth + 1, max_depth);
}
}
}
static void doit(ArrayList res)
{
for (int i = 2; i <= data.Length; i++)
{
for (int j = 0; j < data.Length; j++)
{
next(res, data[j], j + 1, data.Length, 2, i);
}
}
}
}
}