Skip to content

Instantly share code, notes, and snippets.

@andrebires
Created April 29, 2015 16:22
Show Gist options
  • Save andrebires/4e003868a6d56889511f to your computer and use it in GitHub Desktop.
Save andrebires/4e003868a6d56889511f to your computer and use it in GitHub Desktop.
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the number of iteractions: ");
int count;
if (!int.TryParse(Console.ReadLine(), out count)) count = 10;
var value = "x";
while (count-- > 0)
{
Console.WriteLine(value);
value = value
.GroupBy(c => c)
.Select(v => string.Format("{0}{1}", v.Count(), v.Key))
.Aggregate((v1, v2) => string.Format("{0}{1}",v1,v2));
}
Console.WriteLine("Press any key to end");
Console.ReadLine();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment