Counts words in a text file