Easy Solution using Counting
Intuition\n Describe your first thoughts on how to solve this problem. \ncounting and hashmap\n# Approach\n Describe your approach to solving the problem. \ncou
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\ncounting and hashmap\n# Approach\n<!-- Describe your approach to solving the problem. -->\ncount each senders word and store in hashmap. If current count is more than max_count, then update the sender\n# Complexity\n- Time complexity:$$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vector<string>& senders) {\n        int max_count = INT_MIN, cnt, n=senders.size();        \n        map<string, int> mp;\n\n        string msg, sender, ms="";\n        \n        for (int i=0; i<n; i++) {\n            msg = messages[i], sender = senders[i];\n            \n            mp[sender] += count(msg.begin(), msg.end(), \' \')+1;\n            \n            cnt = mp[sender];\n            \n            if (cnt > max_count) {\n                max_count = cnt;\n                ms = sender;\n            }\n            else if (cnt == max_count) {\n                if (sender > ms) ms = sender;\n            }\n            \n        }\n\n        return ms;\n    }\n};\n```
['Counting', 'C++']