对输入的单个字符串进行排序,然后map映射一下
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
map<string, int> node;
map<string, int>::iterator iter;//map迭代器
string s;
for (int i = 0; i < n; i++)
{
int flag = 0;
cin >> s;
sort(s.begin(),s.end());//字符串排序
for (iter = node.begin(); iter != node.end(); iter++)
//遍历
{
if (iter->first == s)
{
flag++;
iter->second++;
break;
}
}
if (!flag)
node.insert(pair<string,int>(s, 1));
}
int ans = 0;
for (iter = node.begin(); iter != node.end(); iter++)
ans = max(ans, iter->second);
cout << ans << endl;
}
}