2114.cpp (263B)
1 class Solution { 2 public: 3 int mostWordsFound(const vector<string> &sentences) const { 4 int res = -1; 5 6 for (const auto &s : sentences) { 7 res = max(res, (int)count(begin(s), end(s), ' ')); 8 } 9 10 return res + 1; 11 } 12 };