Added the countWord method