#include<cstdio>
#include<map>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
char a[100000];
map<string , int> num;
//所有的字符串通过SORT的方法hash,然后计数,注意map的使用
int main()
{
int n;
scanf("%d",&n);
//num.clear();
int i,j;
while(n--)
{
scanf("%s",a);
int str1=strlen(a);
sort(a,a+str1);
printf("%d\n",num[a]);
num[a]++;
}
return 0;
}
Problem D
Accepts: 2916
Submissions: 8882
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/65536 K (Java/Others)