Sender With Largest Word Count
\n\n# Code\n\nclass Solution {\n    static class sArranger implements Comparable<sArranger>{\n        String name;\n        int count;\n        int index;\n    
\n\n# Code\n```\nclass Solution {\n    static class sArranger implements Comparable<sArranger>{\n        String name;\n        int count;\n        int index;\n        sArranger(String s,int c,int i){\n            name=s;\n            count=c;\n            index=i;\n        }\n        public int compareTo(sArranger s){\n            if(this.count==s.count){\n                return s.name.compareTo(this.name);\n            }\n            return s.count-this.count;\n        }\n    }\n    public String largestWordCount(String[] messages, String[] senders) {\n        TreeMap<String,Integer> mp=new TreeMap<>();\n        int maxIndex=0;\n        for(int i=0;i<messages.length;i++){\n            int count=messages[i].split(" ").length;\n            if(mp.containsKey(senders[i]))\n            mp.put(senders[i],mp.get(senders[i])+count);\n            else\n            mp.put(senders[i],count);\n        }\n        PriorityQueue<sArranger> pq=new PriorityQueue<>();\n        Set<String> keys = mp.keySet();\n\n        for(String s:keys){\n            pq.add(new sArranger(s,mp.get(s),0));\n        }\n        return pq.remove().name;\n    }\n}\n```
['Array', 'Hash Table', 'String', 'Counting', 'Java']