//#include #include #include #include #include #include #include #include using namespace std; #include #include #include #include #include #include #pragma comment(linker, "/STACK:1024000000,1024000000") #include typedef long long LL; const int INF = 0x3f3f3f; const int MOD = 1e9+7; const int MAXN = 1e9; const double eps =1e-6; const double pi = acos(-1.0); using namespace std; char s[1234]; LL f[1111]; void ex_gcd(LL a, LL b, LL &x, LL &y) { if(b) { ex_gcd(b, a%b, x, y); LL tmp=x; x=y; y=tmp-(a/b)*y; } else { x=1, y=0; return ; } } int main() { int n; f[0]=1; for(int i=1;i<=1000;i++) f[i]=f[i-1]*i%MOD; scanf("%d",&n); while(n--) { scanf("%s",s); int a[28]; memset(a,0,sizeof(a)); int len=strlen(s); for(int i=0;i1) { printf("0\n"); continue; } LL ans=1; int all=0; for(int i=0;i<26;i++){ if(a[i]>0&&a[i]/2>=1){ LL x,y; ex_gcd(f[a[i]/2],MOD,x,y); x=(x+MOD)%MOD; ans=ans*x%MOD; all+=a[i]/2; } } ans=ans*f[all]%MOD; cout<