#include <iostream>
#include <map>
#include <sstream>
using namespace std;
int main()
{
string line = "paper block book chair";
map<string, int> frequencyMap;
istringstream stream(line);
string word;
while (stream >> word)
{
++frequencyMap[word];
}
string maxRep; int c = 0;
for (auto& t : frequencyMap) {
if (t.second > c) {
maxRep = t.first;
c = t.second;
}
}
cout << "First Most repeated word is: " << maxRep << endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewoJc3RyaW5nIGxpbmUgPSAicGFwZXIgYmxvY2sgYm9vayBjaGFpciI7CgltYXA8c3RyaW5nLCBpbnQ+IGZyZXF1ZW5jeU1hcDsKCgkJaXN0cmluZ3N0cmVhbSBzdHJlYW0obGluZSk7CgkJc3RyaW5nIHdvcmQ7CgoJCXdoaWxlIChzdHJlYW0gPj4gd29yZCkKCQl7CgkJCSsrZnJlcXVlbmN5TWFwW3dvcmRdOwoJCX0KCQoJc3RyaW5nIG1heFJlcDsgaW50IGMgPSAwOwoJZm9yIChhdXRvJiB0IDogZnJlcXVlbmN5TWFwKSB7CgkJaWYgKHQuc2Vjb25kID4gYykgewoJCQltYXhSZXAgPSB0LmZpcnN0OwoJCQljID0gdC5zZWNvbmQ7CgkJfQoJfQoKCWNvdXQgPDwgIkZpcnN0IE1vc3QgcmVwZWF0ZWQgd29yZCBpczogIiA8PCBtYXhSZXAgPDwgZW5kbDsKfQ==