There are many many ways to do this. I whipped this up in about 5 minutes it is a similar but different approach to the solutions posted.
Dictionary<string,int> occurrences = new Dictionary<string,int>();
string strInput = "A peacock is a bird";
string[] strWord = strInput.ToString().ToLower().Split(' ');
for (int i = 0; i < strWord.Length; i++)
{
if (!occurrences.ContainsKey(strWord[i]))
{
int n = 0;
int result = strWord.Count<string>(
delegate { return strWord[i] == strWord[n++]; });
occurrences.Add(strWord[i], result);
}
}
and the code I used to view the results
for (int i = 0; i < occurrences.Count; i++)
{
MessageBox.Show(occurrences.Keys.ElementAt(i) + " - " +
occurrences.Values.ElementAt(i));
}