#include #include #include #include #include #include #include #include #include #include #define MAX 100010 #define MOD 1000000007 using namespace std; struct Node { int data[30] = {0}; Node() {} Node(char c) { data[c-'a'] = 1; } }; Node ST[4*MAX]; string s; Node tong(Node a, Node b) { Node r; for(int i=0;i<30;i++) { r.data[i] = a.data[i] + b.data[i]; } return r; } void build(int id, int l, int r) { if (l == r) { ST[id] = Node(s[l-1]); return; } int mid = (l + r) / 2; build(id * 2, l, mid); build(id * 2 + 1, mid+1, r); ST[id] = tong(ST[id * 2], ST[id * 2 + 1]); } Node get(int id, int l, int r, int u, int v) { if (vr) { return 0;} if (u<=l && r<=v) { return ST[id]; } int mid = (l+r)/2; return tong(get(2*id, l, mid, u, v), get(2*id+1, mid+1, r, u, v)); } long long power(int x, unsigned int y) { if (y == 0) return 1; long long p = power(x, y/2) % MOD; p = (p * p) % MOD; return (y%2 == 0)? p : (x * p) % MOD; } int main() { #ifndef ONLINE_JUDGE freopen("/Users/admin/Documents/INPUT.TXT", "rt", stdin); #endif long long GT[MAX]; GT[1] = 1; GT[0] = 1; for(int i=2;i> s; int q; cin >> q; build(1, 1, s.length()); for(int i=0,u,v;i tmp; int k=0; for(int j=0;j<30;j++) { if(t.data[j] %2==1) { mxLe = max(mxLe, t.data[j]); } if(t.data[j] %2==0 && t.data[j] != 0) { tmp.push_back(t.data[j]); k+=t.data[j]; } } long long a = GT[(k+mxLe)/2]; a = a*power(GT[mxLe/2], MOD-2); for(int j=0;j