If you need the character with most instances in a string (versus the longest sequence of the same character), then the following C# code may help:
string text = "hhbvnnvbmvmvmvbffffffffmmffffff";
Dictionary<char, int> bins = new Dictionary<char, int>();
char max = text.Aggregate(text[0], (a, c) => {
if (bins.ContainsKey(c)) bins[c]++; else bins.Add(c, 1);
return bins[a] < bins[c] ? c : a;
});
Console.WriteLine("{0} = {1} occurances", max, bins[max]);
Cheers
Andi