#include #include #include #include #include #include using namespace std; #define L 1048576 #define P 999983 #define P1 998244353 #define base 29 #define base1 233 #define ll long long char s[45]; struct hash { int h[P],s[L],p[L],ne[L],N; int ins(int x,int y) { int i; for(i=h[x];i;i=ne[i])if(p[i]==y)break; if(i)return s[i]++; else { p[++N]=y; ne[N]=h[x]; h[x]=N; return s[N]++; } } }H; int n,m,i,h,h1; int main() { scanf("%d\n",&n); while(n--) { gets(s); m=strlen(s); sort(s,s+m); for(i=h=h1=0;i