adding counting word function