word-count: Adopt functional style

As discussed in #79.
Merge pull request #82 from sjakobi/functional-word-count

word-count: Adopt functional style