C++ 代码
//stl自带multiset容器进行操作操作,直接插入,查找
#include<iostream>
#include<set>
using namespace std;
multiset<string>se;//定义容器内部元素是字符串的multiset容器se
int main()
{
string s,temp;
int n;
cin>>n;
while(n--)
{
cin>>s>>temp;
if(s=="I")
se.insert(temp);//往se里面插入temp字符串
else
cout<<se.count(temp)<<'\n';//返回temp字符串在se里面的数量
}
return 0;
}