I have written various bits of code to count the number of occurrences of a word or the total number of words in a given body of text, but I'm wondering if someone can help me write a piece of code that returns the total number of occurrences for all words in the body of text.
For example:
If my text body was "No pain, no gain."
The desired output would be:
There were 2 occurrences of "no" in the text.
There were 1 occurrences of "pain" in the text.
There were 1 occurrences of "gain" in the text.
Thanks!