00
05
06 #include <iostream>
07 #include <string>
08 #include <map>
09
10 using namespace std;
11
12 void readitems(map<string, int> &m)
13 {
14 string word;
15 int val;
16
17 while (cin >> word >> val)
18 m[word] += val;}
20
21 int main()
22 {
23 map<string,int> str_count;
25 readitems(str_count);
26
27 int total = 0; for(const auto& [key, value]: str_count)
31 {
32 total += value;
33 cout << key << "\t\t" << value << endl;
34 }
35
36 cout << "-------------------------\ntotal\t\t" << total << endl;
37 }
38
39
40