提交时间:2024-05-18 16:49:41
运行 ID: 147625
#include<iostream> #include<string> #include<map> using namespace std; map<string,int> mp; int main(){ string s; int n; cin>>n; for(int i = 1; i <= n; i++){ cin>>s; mp[s] = 0; } int m; cin>>m; for(int i = 1; i <= m; i++){ cin>>s; if(mp.count(s) != 0){ mp[s]++; } } for(auto p : mp){ cout<<p.first<<' '<<p.second<<'\n'; } return 0; }