题目:
AC代码:
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <string>
using namespace std;
map <string,vector<string>> a;
int n;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
int opt;
cin>>opt;
if(!opt)
{
string p,x;
cin>>p>>x;
a[p].push_back(x);
}
else
{
string p;
cin>>p;
a[p].clear();
}
}
for(auto to:a)
{
if(to.second.empty()) continue;
else
{
cout<<to.first<<" ";
for(auto t:to.second) cout<<t<<" ";
cout<<endl;
}
}
return 0;
}