先把不是标准格式的字符串变成标准格式
再输出出现两次以上的标准串和出现的次数
不然输出 "No duplicates."
#include <iostream>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int n;
map<char,char> num;
map<string,int> mp;
string a;
char s[];
vector<string> ans;
int main()
{
num.clear();
mp.clear();
ans.clear();
num['A'] = num['B'] = num['C'] = '';
num['D'] = num['E'] = num['F'] = '';
num['G'] = num['H'] = num['I'] = '';
num['J'] = num['K'] = num['L'] = '';
num['M'] = num['N'] = num['O'] = '';
num['P'] = num['R'] = num['S'] = '';
num['T'] = num['U'] = num['V'] = '';
num['W'] = num['X'] = num['Y'] = '';
cin>>n;
for (int i = ; i <= n; i++)
{
a.clear();
cin>>s;
for (int i = ; s[i] != '\0'; i++)
{
if(s[i]>='' && s[i]<='') a+=s[i];
else if(s[i] >= 'A' && s[i] <= 'Z' && s[i] != 'Q' && s[i] != 'Z')
a+= num[s[i]];
if(a.length() == ) a+='-';
}
if(a.length() == )
{
mp[a]++;
if(mp[a] == ) ans.push_back(a);
}
}
sort(ans.begin(), ans.end());
if(ans.size() == )
{
cout<<"No duplicates."<<endl;
}
else
{
for (int i = ; i < ans.size(); i++){
cout<<ans[i]<<" "<<mp[ans[i]]<<endl;
}
}
}