made the map function for the word count