Java Treemap
\nclass Solution {\n    public String largestWordCount(String[] messages, String[] senders) {\n        Map<String,Integer> m=new TreeMap<>();\n        int n=mes
```\nclass Solution {\n    public String largestWordCount(String[] messages, String[] senders) {\n        Map<String,Integer> m=new TreeMap<>();\n        int n=messages.length;\n        for(int i=0;i<n;i++){\n            String a[]=messages[i].split(" ");\n            if(m.containsKey(senders[i])){\n                m.put(senders[i],m.get(senders[i])+a.length);\n            }else{\n                m.put(senders[i],a.length);\n            }\n        }\n        \n        int max=Collections.max(m.values());\n        String ans="";\n        for(Map.Entry k : m.entrySet()){\n            int x= (int)k.getValue();\n            if(x==max){\n                ans=String.valueOf(k.getKey());\n            }\n        }\n        return ans;\n    }\n}\n\n```
['Java']