How to count occurrences of a word in a long text