Faster || Easy To Understand || C++ Code
Time Complexity : O(N * size of string)\n\n Space Complexity : O(N)*\n\n\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vecto
* ***Time Complexity : O(N * size of string)***\n\n* ***Space Complexity : O(N)***\n\n```\nclass Solution {\npublic:\n    string largestWordCount(vector<string>& messages, vector<string>& senders) {\n        \n        int n = messages.size();\n        \n        unordered_map<string, int> mp;\n        \n        for(int i = 0; i < n; i++)\n        {\n            string str = messages[i];\n            \n            string name = senders[i];\n            \n            int count = 0;\n            \n            for(int j = 0; j < str.size(); j++)\n            {\n                if(str[j] == \' \')\n                {\n                    count++;\n                }\n            }\n            \n            mp[name] += count + 1;\n        }\n        \n        int maxi = 0;\n        \n        string max_name = "";\n        \n        for(auto x : mp)\n        {\n            if(x.second > maxi)\n            {\n                maxi = x.second;\n                \n                max_name = x.first;\n            }\n            else if(x.second == maxi)\n            {\n                if(max_name < x.first)\n                {\n                    max_name = x.first;\n                }\n            }\n        }\n        \n        return max_name;\n    }\n};\n```
['C']