using System.Text.RegularExpressions;
public static void Main()
var str = "Bob hit a ball, the hit BALL flew far after it was hit.";
var forbidden = new [] {"hit"};
var matches = new Regex(@"\b(\w+)\b" ).Matches(str).Select(x => x.Value.ToLowerInvariant());
var allowedMatches = matches.Where(s => !forbidden.Contains(s));
var counts = allowedMatches.ToLookup(x => x).ToDictionary(g => g.Key, g => g.Count());
FiddleHelper.WriteTable(counts);
var mostCommon = counts.OrderByDescending(kv => kv.Value).Select(kv => kv.Key).FirstOrDefault();
Console.WriteLine(mostCommon);