#include<bits/stdc++.h>
using namespace std;
char ss[2500];
int ott=0,id;
int tied[3000000][80],sum[3000000];
void insert(){
int root=0;
int len=strlen(ss);
for(int i=0;i<len;i++){
id=ss[i]-'0';
if(tied[root][id]==0){
ott++;
tied[root][id]=ott;
}
root=tied[root][id];
sum[root]++;
}
}
int search(){
int root=0;
int len=strlen(ss);
for(int i=0;i<len;i++){
int id=ss[i]-'0';
if(tied[root][id]==0)return 0;
root=tied[root][id];
}
return sum[root];
}
int main(){
int n,m,z;
cin>>n;
while(n--){
memset(sum,0,sizeof(sum));
memset(tied,0,sizeof(tied));
cin>>m>>z;
ott=0;
while(m--){
cin>>ss;
insert();
}
int ans=0;
while(z--){
cin>>ss;
ans=search();
cout<<ans<<endl;
}
}
return 0;
}
## ```有没有大佬帮忙看看我这个代码为什么会出现wa和tle的问题,回复闭关,谢谢啦谢谢啦。