#include #include #include using namespace std; int code[]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,0,7,7,8,8,8,9,9,9}; int base[]={1,10,100,1000,10000,100000,1000000};
int array[100005]; int total; int main() { int n,len,m; int num,t,i; char s[100]; scanf("%d",&n); m=0; for(i=0;i { scanf("%s",s); t=0;num=0; len=strlen(s); for(int j=len-1;j>-1;j--) { if(s[j]=='-') continue; if(s[j]>='0'&&s[j]<='9') num+=(s[j]-'0')*base[t++]; else num+=(code[s[j]-'A'])*base[t++]; } array[m++]=num; } sort(array,array+m); int b=0; for(i=0;i { if(i==0) { total=1;continue; } if(array[i]!=array[i-1]) { if(total>1){ printf("%03d-%04d %d\n",array[i-1]/10000,array[i-1]%10000,total); if(!b) b=1; } total=1; continue; } total++; } if(total>1){ printf("%03d-%04d %d\n",array[i-1]/10000,array[i-1]%10000,total); if(!b) b=1; }