#29049: c++ map_solution


s411085056@gm.ntpu.edu.tw (小宥)


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n;
cin >> n;
map <string, int> mp;
string temp;
while (n--) {
string contry;
cin >> contry >> temp >> temp;
mp[contry]++;
}
for (auto i : mp)
cout << i.first << ' ' << i.second << endl;
return 0;
}