//raja1999 #include #include #include #include #include #include #include #include #include #include #include #include #include #include //setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64 //setfill - cout << setfill ('x') << setw (5); cout << 77 <=b;i--) #define pb push_back #define mp make_pair #define vi vector< int > #define vl vector< ll > #define ss second #define ff first #define ll long long #define pii pair< int,int > #define pll pair< ll,ll > #define sz(a) a.size() #define inf (1000*1000*1000+5) #define all(a) a.begin(),a.end() #define tri pair #define vii vector #define vll vector #define viii vector #define mod (1000*1000*1000+7) #define pqueue priority_queue< int > #define pdqueue priority_queue< int,vi ,greater< int > > //std::ios::sync_with_stdio(false); ll inv[100003],mult[100003],invmult[100003],a[100003],coun[100003],sum[100005][30]; ll power(ll a,ll b){ ll res=1,base=a; while(b>0){ if(b%2){ res*=base; res%=mod; } base*=base; base%=mod; b/=2; } return res; } ll gcd(ll a,ll b){ while(b!=0){ a=a%b; swap(a,b); } return a; } ll extend_gcd(ll a,ll b,ll &x,ll &y){ if(b==0){ x=1; y=0; return a; } ll x1,y1; ll ans =extend_gcd(b,a%b,x1,y1); x=y1; y=x1-(a/b)*y1; return ans; } ll combination(ll n,ll r){ if(r==0) return 1; if(n0) inv[i]=y%mod; else{ inv[i]=(y+mod)%mod; } } mult[0]=1; f(i,1,100001){ mult[i]=mult[i-1]*i; mult[i]%=mod; } invmult[0]=1; f(i,1,100001){ invmult[i]=invmult[i-1]*inv[i]; invmult[i]%=mod; } return 0; } // do initcombi(); int main(){ std::ios::sync_with_stdio(false); string s; int q,i,h,l,r,j; ll val,val1; cin>>s; cin>>q; initcombi(); rep(i,s.length()){ rep(j,26){ sum[i][j]=i>0?sum[i-1][j]:0; } sum[i][s[i]-'a']++; } rep(i,q){ cin>>l>>r; l--; r--; int c=0,c1=0; vector< int >v; rep(j,26){ val=sum[r][j]; if(l>0){ val-=sum[l-1][j]; } if(val%2==0){ v.pb(val/2); c+=(val/2); } else{ v.pb(val/2); c+=(val/2); c1++; } } //cout<