What is the most optimal way (algorithm) to search for the word that has the maximum number of occurrences in a document?