Problem C
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 131072/131072 K (Java/Others)
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
int main()
{
map<string,int> mp;
int n;
char str[42];
cin>>n;
while(n--)
{
cin>>str;
sort(str,str + strlen(str));
cout<<mp[str]<<endl;
mp[str] = ++mp[str];
}
}