#include #include #include #include #include #include #include int main() { char text[100]; int begin, middle, end, length = 0,ctr=0,l,t,r; scanf("%s\n",text); scanf("%d\n",&t); while(t>0) {ctr=0; scanf("%d %d",&l,&r); while (text[length] != '\0') length++; end = length - 1; middle = length/2; for (begin=r; begin>=l; begin--) { end--; if (begin == middle) { ctr++; printf("%d\n",ctr+1); } } t--; } return 0; }