passing test cases for counting words