[CSHARP] int GetFreq(string word) { string st = null; st = 'StringThatContainWord'; int start = 0, count = 0, curr = 0; int last = st.LastIndexOf(word); do { curr = st.IndexOf(word, start); if (curr != -1) { count++; start = curr + 1; } } while (last != curr); return count }[/CSHARP]