记录
使用
#include<iostream>
#include<map>
using namespace std;
void Solve()
{
map <string,int> mp;
int n,m;
string a,tmp;
cin >> n >> m;
for(int i = 1;i <= n;i++)
{
tmp = "";
cin >> a;
for(int j = 0;j < a.size();j++)
{
tmp += a[j];
mp[tmp]++;
}
}
for(int i = 1;i <= m;i++)
{
cin >> a;
cout << mp[a] << '\n';
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t;
cin >> t;
while(t--)
Solve();
return 0;
}
居然能AC