POJ 1002
#include<iostream>
#include<set>
#include<stdio.h>
#include<string>
#include<algorithm>
using namespace std;
string _m[100005];
int main()
{
//freopen("acm.acm","r",stdin);
int num;
int i;
int j;
int past;
int t;
int u;
int index;
int time = 0;
string s1;
string s2;
string::iterator pos2;
char mp[26] = {'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7',' ','7','7','8','8','8','9','9','9'};
scanf("%d",&num);
for(i = 0; i < num; ++ i)
{
cin>>s1;
for(pos2 = s1.begin();pos2 != s1.end(); )
{
if(*pos2 == '-')
s1.erase(pos2);
else
{
if(*pos2 >= 'A' && *pos2 <= 'Z')
{
*pos2 = mp[*pos2-'A'];
}
++ pos2;
}
}
s1.insert(s1.begin()+3,'-');
_m[i] = s1;
}
sort(_m,_m + num);
s2 = _m[0];
j = 0;
for(t = 0; t < num; ++ t)
{
if(_m[t] == s2)
++ j;
else
{
if(j > 1)
{
time = 1;
cout<<s2;
cout<<' '<<j<<endl;
}
s2 = _m[t];
-- t;
j = 0;
}
}
if(j > 1)
{
time = 1;
cout<<_m[num - 1];
cout<<' '<<j<<endl;
}
if(time == 0)
cout<<"No duplicates. "<<endl;
}