Frage im Vorstellungsgespräch bei Cognizant

Write a java program to count the words in a given string