Assuming that the definition of a word is one or a group of character(s) that is space delimited, then you may want to just count the number of words using the string split function
string s = "hello world 1 2 3 ";
System.Diagnostics.Debug.WriteLine(GetNumWord(s)+ " words");
int GetNumWord(string s)
{
var words=s.Split(new char[] {' '},StringSplitOptions.RemoveEmptyEntries);
return words.Length;
}
In the above test, the output is 5 words, extra spaces are ignored.