Can anyone explain for which case this code is not working?
string largestWordCount(vector<string>& messages, vector<string>& senders) {
int n=messages.size();
unordered_map<string,int>u;
for(int i=0; i<n; i++) {
string s=messages[i];
int state=0, wc=0;
for(int j=0; j<s.length(); j++) {
if(s[j] == ' ')
state=0;
else if(state==0)
{
state=1;
++wc;
}
}
if(u.find(senders[i]) != u.end())
u[senders[i]] += wc;
else
u[senders[i]] = wc;
}
int mx = INT_MIN;
string final;
for(auto itr=u.begin(); itr!=u.end(); itr++) {
if(mx < itr->second)
{
mx=itr->second;
final = itr->first;
}
}
return final;
}
```