Amazon Interview Question

java function to find the word count on a string