word count using dictionary