#include #include #include #include #include #include using namespace std; string initialize(string s, int l,int r) { return s.substr(l-1,r-l+1); } int answerQuery(string s) { int len = s.length(); unordered_map mp; int even=0, odd=0,one=0; for(int i=0;isecond)%2 == 0 && it->second>=even) even=(even%M+(it->second/2)%M); /*else if((it->second)==1) one+=1;*/ else if(it->second >odd) odd=(it->second-1)%M; } if(one%2==0) even+=one/2; double p =even; double q = odd; return max(p,q); } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ string s; getline(cin,s); int q; cin>>q; while(q--) { int l,r; cin>>l>>r; string s2 = initialize(s,l,r); //cout<