string inputstring = "apple";
var g = from c in inputstring.ToLower().ToCharArray()
group c by c into m
select new { Key = m.Key, Count = m.Count() };
foreach (var item in g)
{
Console.WriteLine(string.Format("{0} {1}", item.Key.ToString(), item.Count));
}The code snippet helps you to find out occurrence of characters in a word/string.if the input is "apple"
output will be:
a 1
p 2
l 1
e 1
