Count number of words in a string or a file