implement counter to collect word stat