var groups = Enumerable.Range(1, 100).GroupBy(i => i % 10);
foreach (var group in groups)
{
Console.WriteLine(group.Key + ":" + group.Count());
}
string str="aa,ab,ac,ba,bb,ca";
var strs=str.Split(',');
int[] lengs=(from s in strs
group s by s.First() into ss
select ss.Count()).ToArray();