Two Solution (StringStream and Count Space)
Store the count of words sent by each sender and find the sender with the largest word count in the hashmap.\n\n\nclass Solution {\npublic:\n    string largestW
***Store the count of words sent by each sender and find the sender with the largest word count in the hashmap.***\n\n```\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vector<string>& senders) {\n        \n        int n(size(messages));\n        map<string, int> m;\n        for (auto i=0; i<n; i++) {\n            \n            stringstream ss(messages[i]);\n            string word;\n            int count(0);\n            while (ss >> word)   count++;\n            m[senders[i]] += count;\n        }\n        \n        int count(0);\n        string res;\n        for (auto& p : m) {\n            if (p.second >= count) {\n                count = p.second;\n                if (!res.empty() or res < p.first)  res = p.first;\n            }\n        }\n        return res;\n    }\n};\n```\n\n**Count space to find number of words**\n```\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vector<string>& senders) {\n        \n        auto doit = [&](string& message) {\n            int word(1);\n            for (auto& ch : message)    if (ch == \' \')  word++;\n            return word;\n        };\n        \n        int n(size(messages));\n        map<string, int> m;\n        for (auto i=0; i<n; i++)\n            m[senders[i]] += doit(messages[i]);\n        \n        string res;\n        int count(0);\n        for (auto& p : m) {\n            if (p.second >= count) {\n                count = p.second;\n                if (!res.empty() or res < p.first)  res = p.first;\n            }\n        }\n        return res;\n    }\n};\n```
['C']