C++ Solution Using Hashmap | Simple & Easy
Just create a map of (string, int) pair and store the count of no of words for each word in the map. \nAfter this iterate and find the strings for maximum count
Just create a map of (string, int) pair and store the count of no of words for each word in the map. \nAfter this iterate and find the strings for maximum count, if 2 such string exists, check which one is lexicographically greater and print the required output.\n\n```\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vector<string>& senders) {\n        map<string, int> mp;\n        for(int i = 0;i < messages.size(); i++)\n        {\n            int count = 0;\n            string tmp = messages[i];\n            for(char ch : tmp) \n                if(ch == \' \') \n                    count++;\n                mp[senders[i]] += count + 1;\n        }\n        string ans = "";\n        int mx = INT_MIN;\n        for(auto i : mp)\n        {\n            if(i.second >= mx)\n            {\n                mx = i.second;\n                if(i.first > ans) \n                    ans = i.first;\n            }\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'C++']