Similar approach to "Top k Frequent Words"
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String largestWordCount(String[] messages, String[] senders) {\n        int n = senders.length;\n        int[] count = new int[n];\n\n        for(int i=0; i< n; i++){\n            String currmessage = messages[i];\n            String[] arr = currmessage.split(" ");\n            int val = arr.length;\n            count[i] = val;\n        }\n        HashMap<String, Integer> map = new HashMap<>();\n        for(int i=0; i< n; i++){\n            map.put(senders[i], map.getOrDefault(senders[i], 0) + count[i]);\n        }\n        PriorityQueue<String> maxHeap = new PriorityQueue<>(\n            (a,b) ->{\n                //if length is same sort according to name \n                if(map.get(a).equals(map.get(b))){\n                    return b.compareTo(a);\n                }\n                //else according to count of words\n                else{\n                    return map.get(b) - map.get(a);\n                }\n            }\n        );\n\n        for(String s: map.keySet()){\n            maxHeap.offer(s);\n        }\n        return maxHeap.poll();\n    }\n}\n```
['Java']