Pergunta de entrevista da empresa Infosys

Write a programme where you will pass a string, and that string should return all the possible word counts.