#pragma warning (disable:4996) #include #include #include #include #include #include #include #include using namespace std; map mp; char str[45]; int a[45]; string st; void read(){ char c; int cnt=0; while(c=getchar()){ if(c!='\n'){ str[++cnt]=c; } else break; } str[++cnt]='\0'; return; } int main(){ int i,j,n,m; while(scanf("%d",&n)!=EOF){ getchar(); mp.clear(); for(i=1;i<=n;i++){ read(); m=strlen(str+1); sort(str+1,str+m+1); st=""; for(j=1;j<=m;j++) st+=str[j]; printf("%d\n",mp[st]); mp[st]++; } } //system("pause"); return 0; }