Skip to content

Instantly share code, notes, and snippets.

@erickgirard
Last active January 26, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erickgirard/d79b705964d105b68ad5954ec90f5449 to your computer and use it in GitHub Desktop.
Save erickgirard/d79b705964d105b68ad5954ec90f5449 to your computer and use it in GitHub Desktop.
Civic address problem
using System;
using System.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var numbers = new[] { "1425", "33133", "3587", "2080" };
var numberGroups = string.Join("", numbers).ToCharArray().GroupBy(key => key);
foreach (var group in numberGroups)
{
Console.WriteLine($"{group.Key} Count: {group.Count()}");
}
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment