word count method implemented