#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
map<string, size_t> m;
string word;
while (cin >> word) {
++m[word];
}
for (map<string, size_t>::iterator it = m.begin(); it != m.end(); ++it)
{
cout << it->first << " " << it->second << endl;
}
getchar();
return 0;
}
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
map<string, int> m;
cout << "Enter some string & int:" << endl;
while (true) {
string word;
int n;
cin >> word >> n;
if (!cin) break;
m[word] = n;
}
string search_string = "river";
map<string, int>::iterator it = m.find(search_string);
if (it == m.end()) {
cout << "not found" << endl;
} else {
cout << it->first << " " << it->second << endl;
}
getchar();
return 0;
}