Implementation of WordCounter