#include using namespace std; #define pb push_back #define mp make_pair typedef long long int ll; int factorial(int n) { int f = 1; for(int i=2 ; i<=n ; i++) f*=i; return f; } ll count_palindromes(string s) { int a[26]={0}; for(int i=0,l = s.length() ; i>s; int q; cin>>q; while(q--) { int l,r; cin>>l>>r; l--; string t = s.substr(l,r); ll count = count_palindromes(t); cout<