2284. Sender With Largest Word Count
Содержание
class Solution:
def largestWordCount(self, messages: List[str], senders: List[str]) -> str:
cnt = Counter()
for msg, sender in zip(messages, senders):
cnt[sender] += msg.count(' ') + 1
res = ''
for sender, v in cnt.items():
if cnt[res] < v or (cnt[res] == v and res < sender):
res = sender
return res