Question d’entretien chez Amazon

java function to find the word count on a string