Infosys Interview Question

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