Skip to content

Instantly share code, notes, and snippets.

@n0rev
Last active January 26, 2017 14:22
Show Gist options
  • Select an option

  • Save n0rev/d79b705964d105b68ad5954ec90f5449 to your computer and use it in GitHub Desktop.

Select an option

Save n0rev/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