#include #include #include #include #include #include using namespace std; map m; int n; char cstr[40]; bool cmp(char a, char b){ return a > b; } int main() { //freopen("1004.txt", "r", stdin); scanf("%d", &n); //getchar(); while(n--){ string s; memset(cstr, 0, sizeof(cstr)); scanf("%s", cstr); sort(cstr,cstr+40, cmp); //cout << cstr << endl; s = string(cstr); printf("%d\n", m[s]); m[s]++; } return 0; }