一个错误找不出来……【关于字符处理的】提示RE,无法通过啊!!!!
http://#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void PRINTNUM(string a)
{
int j;
for (j=0;j<7;j++)
{
cout<<a[j];
if (j==2)
cout<<"-";
}
}
int main()
{
int n,i,j,cnt;
int c2num[25]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9};
string istr[1000];
string phonum[1000];
cin>>n;
for (i=0;i<n;i++)
cin>>istr[i];
for (i=0;i<n;i++)
{
cnt=0;
for (j=0;j<istr[i].size();j++)
{
if (isupper(istr[i][j]) &&istr[i][j]!='Z')
{
phonum[i]+=c2num[istr[i][j]-'A']+'0';
}
if (isdigit(istr[i][j]))
{
phonum[i]+=istr[i][j];
}
}
}
sort(phonum,phonum+n);
for (i=0;i<n;i++)
{
int cnt=0;
j=i;
while(phonum[j] == phonum[j+1])
{
cnt++;
j++;
}
if (cnt)
{
PRINTNUM(phonum[i]);
cout<<" "<<cnt+1<<endl;
i+=cnt;
}
}
return 0;
}
[ 本帖最后由 love24114 于 2012-1-22 10:37 编辑 ]