improved word count solution, no more loops