PersonalCorpus 版 (精华区)
39079 2002-10-06 03:00:22 Accepted
1315 C++ 00:00.00 384K Big Guava
int main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\0acm\\uva\\input409.txt","r",stdin);
freopen("c:\\0acm\\uva\\output409.txt","w",stdout);
#endif
int i,j,k,e,q[21],m,n,p,best,tot=0;
char w[21][30],s[21][100],s2[21][100];
while (scanf("%d%d\n",&k,&e)==2) {
for (i=0;i<k;i++) gets(w[i]);
for (i=0;i<e;i++) gets(s[i]);
memcpy(s2,s,sizeof(s));
best=0; printf("Excuse Set #%d\n",++tot);
for (i=0;i<e;i++) {
p=strlen(s[i]);
q[i]=0; j=0; m=0;
while (1) {
while ((isalpha(s[i][m]))&&(s[i][m]!=0)) {
if ((s[i][m]>='A')&&(s[i][m]<='Z')) s[i][m]+=32;
m++;
}
s[i][m]=0;
for (n=0;n<k;n++) if (strcmp(w[n],s[i]+j)==0) break;
if (n!=k) q[i]++;
while ((m<p)&&(!isalpha(s[i][m]))) m++;
if (m==p) break; else j=m;
}
if (q[i]>best) best=q[i];
}
for (i=0;i<e;i++) if (q[i]==best) printf("%s\n",s2[i]);
printf("\n");
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.088毫秒