#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//散列表
int sl[10000000];
int main()
{
int NUM;
scanf("%d ",&NUM);
char s[NUM][100];
memset(s,0,sizeof(s));
int i;
for(i=0;i<NUM;i++)
{
scanf("%s",&s[i]);
}
int j;
for(j=0;j<NUM;j++)
{
int taiy=0;
for(i=0;i<strlen(s[j]);i++)
{
if(s[j][i]=='-')
{
continue;
}
else if(s[j][i]!='-')
{
if((s[j][i]>='0')&&(s[j][i]<='9'))
{
taiy=taiy*10+s[j][i]-'0';
}else if((s[j][i]=='A')||(s[j][i]=='B')||(s[j][i]=='C'))
{
taiy=taiy*10+'2'-'0';
}else if((s[j][i]=='D')||(s[j][i]=='E')||(s[j][i]=='F'))
{
taiy=taiy*10+'3'-'0';
}else if((s[j][i]=='G')||(s[j][i]=='H')||(s[j][i]=='I'))
{
taiy=taiy*10+'4'-'0';
}else if((s[j][i]=='J')||(s[j][i]=='K')||(s[j][i]=='L'))
{
taiy=taiy*10+'5'-'0';
}else if((s[j][i]=='M')||(s[j][i]=='N')||(s[j][i]=='O'))
{
taiy=taiy*10+'6'-'0';
}else if((s[j][i]=='P')||(s[j][i]=='R')||(s[j][i]=='S'))
{
taiy=taiy*10+'7'-'0';
}else if((s[j][i]=='T')||(s[j][i]=='U')||(s[j][i]=='V'))
{
taiy=taiy*10+'8'-'0';
}else if((s[j][i]=='W')||(s[j][i]=='X')||(s[j][i]=='Y'))
{
taiy=taiy*10+'9'-'0';
}
}
}
//printf("%d\n",taiy);
sl[taiy]++;
}
int flag=0;
for(i=0;i<10000000;i++)
{
if(sl[i]>1)
{
printf("%d",i/1000000);
printf("%d",(i/100000)%10);
printf("%d",(i/10000)%10);
printf("-");
printf("%d",(i/1000)%10);
printf("%d",(i/100)%10);
printf("%d",(i/10)%10);
printf("%d",i%10);
printf(" %d\n",sl[i]);
flag=1;
}
}
if(flag==0)
{
printf( "No duplicates.\n" );//谢谢赵瑞阳老师
}
return 0;
}
把包括字母的电话号码翻译成数字。按字母序输出出现大于2次的电话号码。如果没有号码重复输出“No duplicates. ”。