3个大写字母出现次数
hash最初步
#include<cstdio>
int hashFunc(char str[],int n){
int sum=0;
for(int i=0;i<n;i++){
sum=sum*26+(str[i]-'A');
}
return sum;
}
int main(){
int m,n,hashtable[26*26*26+10];
char str[100];
scanf("%d%d",&m,&n);
for(int i=0;i<m;i++){
scanf("%s",str);
int temp=hashFunc(str,3);
hashtable[temp]++;
}
for(int j=0;j<n;j++){
scanf("%s",str);
int temp=hashFunc(str,3);
printf("%s::%d",str,hashtable[temp]);
}
return 0;
}