Exercise: Count words using two vectors
- Given a string that consists of words and white-spaces, count how many times each word appears!
- In this solution we use two vectors. A much better solution would be to use
HashMap
, but in this example I wanted to show the solution with two vectors. - One vector will hold the list of distinct words.
- The second vector will hold the count for each word.