#include <bits/stdc++.h>
using namespace std;
map<string, map<string,int> >a;
int main(){
	int n, x;
	cin >> n;
	string diqu, fruit;
	for (int i = 0; i < n; ++i){
		cin >> fruit >> diqu >> x;	
		a[diqu][fruit] += x;
	}
	map<string, map<string, int> > :: iterator it1;
	for (it1 = a.begin(); it1 != a.end(); it1++){	
		cout << it1->first << '\n'; //地区
		map<string,int> :: iterator it2;
		for (it2 = (it1->second).begin(); it2 != (it1->second).end(); ++it2){
			cout << "   |----" << it2->first << "(" << it2->second << ")" << '\n';
		}
	}
	return 0;
}

0 comments

No comments so far...