exercise 1-12 :

I looked over the suggested version from the answer book and it looks
like they copied the word counting example from earlier in the section
and modified it to do what was asked in the exercise. I went a different
direction with my version. Not sure which is "better", they both work