Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Playground
- {
- class Program
- {
- static char[] collector = new char[0];
- static void Main()
- {
- int limit = 0;
- Console.Write("How many letters deep? ");
- int.TryParse(Console.ReadLine(), out limit);
- Challenge(limit);
- }
- static char IncrementChar(ref char character)
- {
- character++;
- if (character > '9' && character < 'a')
- {
- character = 'a';
- }
- else if (character > 'z')
- {
- character = '0';
- }
- return character;
- }
- static void Challenge(int limit)
- {
- char currentChar = (char) ('0' - 1);
- for (int i = 0; i < limit; i++)
- {
- for (int j = 0; j < Math.Pow(36, collector.Length); j++)
- {
- for (int k = 0; k < 36; k++)
- {
- foreach (char letter in collector)
- {
- Console.Write(letter);
- }
- Console.WriteLine(IncrementChar(ref currentChar));
- }
- if (i > 0)
- {
- for (int k = 1;
- IncrementChar(ref collector[collector.Length - k]) == '0' && k < collector.Length;
- k++) ;
- }
- }
- char[] temp = collector;
- collector = new char[collector.Length + 1];
- for (int j = 0; j < temp.Length; j++)
- {
- collector[j] = temp[j];
- }
- collector[collector.Length - 1] = '0';
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement