#include<iostream> #include<cstring> using namespace std; int main(){ char dict[10005][20],tar[20],tmp[20]; int count,i,j,diff_num; bool flag; count = 0; while(scanf("%s",tmp)==1&&strcmp(tmp,"#")!=0){ strcpy(dict[count++],tmp); } while(scanf("%s",tmp)==1&&strcmp(tmp,"#")!=0){ flag = false; for(i=0;i<count;i++){ if(strcmp(tmp,dict[i])==0){ flag = true; } } if(flag){ printf("%s is correct\n",tmp); continue; } printf("%s:",tmp); for(i=0;i<count;i++){ if(strlen(tmp)==strlen(dict[i])){ diff_num = 0; for(j=0;j<strlen(tmp);j++){ if(tmp[j]!=dict[i][j]) diff_num++; } if(diff_num==1) printf(" %s",dict[i]); } else if(strlen(tmp)==strlen(dict[i])+1){ j = 0; while(j<strlen(dict[i])&&tmp[j]==dict[i][j])j++; while(j<strlen(dict[i])&&tmp[j+1]==dict[i][j])j++; if(j==strlen(dict[i])) printf(" %s",dict[i]); } else if(strlen(tmp)==strlen(dict[i])-1){ j = 0; while(j<strlen(tmp)&&tmp[j]==dict[i][j])j++; while(j<strlen(tmp)&&tmp[j]==dict[i][j+1])j++; if(j==strlen(tmp)) printf(" %s",dict[i]); } } printf("\n"); } return 0; }