#include #include #include #include #include using namespace std; map, int> book; int main() { int N; char temp[45]; scanf("%d", &N); getchar(); while (N--) { vector s(26, 0); gets(temp); for (int i = 0; temp[i] != '\0'; ++i) ++s[temp[i] - 'A']; cout << book[s]++ << endl; } return 0; }