Count Spaces
The number of words in a message is the number of spaces, plus one.\n\nWe count words for each sender using a hash map, and track max count with the sender\'s n
The number of words in a message is the number of spaces, plus one.\n\nWe count words for each sender using a hash map, and track max count with the sender\'s name.\n\n**C++**\n```cpp\nstring largestWordCount(vector<string>& messages, vector<string>& senders) {\n    unordered_map<string, int> cnt;\n    string res;\n    int max_cnt = 0;\n    for (int i = 0; i < messages.size(); ++i) {\n        int words = count(begin(messages[i]), end(messages[i]), \' \') + 1;\n        int total = cnt[senders[i]] += words;\n        if (total > max_cnt || (total == max_cnt && senders[i] > res)) {\n            max_cnt = total;\n            res = senders[i];\n        }\n    }\n    return res;\n}\n```
['C']