Counts words and adds keys and values to dictionary.