class Solution { public: int countWords(string str) { // Breaking input into word // using string stream // Used for breaking words stringstream s(str); // To store individual words string word; int count = 0; while (s >> word) count++; return count; } int mostWordsFound(vector<string>& sen) { int n=sen.size(); int maxi=INT_MIN; for(int i=0;i<n;i++) { maxi=max(maxi,countWords(sen[i])); } return maxi; } };