TCS interview question

Count the words in a string