#include"stdio.h"
#include"string.h"
struct str
{
char *ch;
long int m;
}phone[1000000];
main()
{
char *a,*number;
char b[1000000][21],c[1000000][21],x[1000000][21];
long int i,n=0,flag=0,d[10000000],e[1000000],j=0,k=0,y,z=1,temp;
while((scanf("%s",number))!=EOF)
{
strcpy(x[n],number);
for(i=0;i<20;i++)
{
if(number[i]=='A'||number[i]=='B'||number[i]=='C')
x[y][i]='2';
if(number[i]=='D'||number[i]=='E'||number[i]=='F')
x[y][i]='3';
if(number[i]=='G'||number[i]=='H'||number[i]=='I')
x[y][i]='4';
if(number[i]=='J'||number[i]=='K'||number[i]=='L')
x[y][i]='5';
if(number[i]=='M'||number[i]=='N'||number[i]=='O')
x[y][i]='6';
if(number[i]=='P'||number[i]=='R'||number[i]=='S')
x[y][i]='7';
if(number[i]=='T'||number[i]=='U'||number[i]=='V')
x[y][i]='8';
if(number[i]=='W'||number[i]=='X'||number[i]=='Y')
x[y][i]='9';
}
for(i=0;i<20;i++)
{
if(x[y][i]!='-')
{
x[y][n]=x[y][i];
}
}
y++;
}
for(j=0;j<y;j++)
{
for(i=0;i<20;i++)
{
if(x[j][0]!='3'||x[j][0]!='6'||x[j][0]!='D'||x[j][0]!='E'||x[j][0]!='F'||x[j][0]!='M'||x[j][0]!='N'||x[j][0]!='O')
{
strcpy(b[flag],x[j]);
d[flag]=j;
flag++;
break;
}
if(a[i]=='Q'||a[i]=='Z')
{
strcpy(b[flag],x[j]);
d[flag]=i;
flag++;
break;
}
}
}
for(i=0;i<y;i++)
{
if(i!=d[flag])
{
for(j=0&&j!=i;j<y;j++)
{
if(strcmp(x[i],x[j])==0)//记录重复的串
{
k=i;
z++;
e[k]==z;
strcpy(c[k],x[i]);
}
else
continue;
}
}
}
printf("Error:\n");
if(flag==0)
printf("Not found.\n");
else
for(i=0;i<flag;i++)
printf("%s\n",b[i]);
printf("Duplication:\n");
if(z==1)
printf("Not found.\n");
else
printf("%s %ld\n",);
} 我写了一个,还没优化。而且在保存重复字符串和其重复次数那儿写不下去了。