#include #include #include #include #include using namespace std; const int MAXN = 45; map,int> Name; vector Now; char S[MAXN]; int N; int main() { scanf("%d", &N); Now.resize(26); for (int i = 1; i <= N; i ++) { scanf("%s", S); int Len = strlen(S); for (int i = 0; i < 26; i ++) Now[i] = 0; for (int i = 0; i < Len; i ++) Now[S[i] - 'A'] ++; printf("%d\n", Name[Now]); Name[Now] ++; } }