#include #include #include std::size_t max_words(const std::vector &vec) { size_t count{},max{}; for(const auto & s : vec) { for(const auto &c : s) if(isspace(c)) count++; if(max < count) max = count; count = 0; } return max+1; } int main(int argc, char **argv) { std::vector vec{"Perl and Raku belong to the same family.", "I love perl.", "The Perl and Raku Conference."}; std::vector vec2{"The Weekly Challenge.", "Python is the most popular guest language.", "Team PWC has over 300 members."}; std::cout << max_words(vec) << '\n'; std::cout << max_words(vec2) << '\n'; return 0; }