Skip to content

Instantly share code, notes, and snippets.

@ilpropheta
Created July 16, 2016 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilpropheta/6dc69f05c91065c77bcccfcaaa56681c to your computer and use it in GitHub Desktop.
Save ilpropheta/6dc69f05c91065c77bcccfcaaa56681c to your computer and use it in GitHub Desktop.
map<string, int> freq;
string curr;
while (cin >> curr)
{
++freq[curr];
}
cout << max_element(begin(freq), end(freq), [](const auto& p1, const auto& p2){
return p1.second < p2.second;
})->first;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment