poj 1002 487-3279
#include <iostream>
#include<string>
#include<map>
using namespace std;
char mapping(char ch)
{
if(ch=='A'||ch=='B'||ch=='C')ch='2';
else if(ch=='D'||ch=='E'||ch=='F')ch='3';
else if(ch=='G'||ch=='H'||ch=='I')ch='4';
else if(ch=='J'||ch=='K'||ch=='L')ch='5';
else if(ch=='M'||ch=='N'||ch=='O')ch='6';
else if(ch=='P'||ch=='R'||ch=='S')ch='7';
else if(ch=='T'||ch=='U'||ch=='V')ch='8';
else if(ch=='W'||ch=='X'||ch=='Y')ch='9';
return ch;
}
int main()
{
map<string,int>number;
map<string,int>::iterator ite;
int n,top;
string str;
cin>>n;
while(n--)
{
cin>>str;
string tmp;top=0;
for(int i=0;i<str.size();i++)
if(str[i]!='-')
{
tmp.push_back(mapping(str[i]));
top++;
if(top==3)tmp.push_back('-');
}
ite=number.find(tmp);
if(ite!=number.end())
ite->second++;
else
number.insert(pair<string,int>(tmp,1));
}
int flag=1;
for(ite=number.begin();ite!=number.end();ite++)
if(ite->second!=1)
{
flag=0;
cout<<ite->first<<" "<<ite->second<<endl;
}
if(flag==1)
cout<<"No duplicates.\n";
return 0;
}