#include #include #include using namespace std; map,int> c; char s[41]; int main() { int n; scanf("%d", &n); while (n--) { vector tmp = vector(26); scanf("%s", s); for (int i = 0; s[i] != '\0'; i++) tmp[s[i] - 'A']++; printf("%d\n", c[tmp]++); } return 0; }