#include using namespace std; string s; void initialize(string s) { // This function is called once before all queries. } int answerQuery(int l, int r) { // Return the answer for this query modulo 1000000007. int c=0,count=0; string p=s; int w[26]={0}; for(int i=l+1;i1 && l!=r) answerQuery( l, r-1) ; else return count; return 0; } int main() { cin >> s; initialize(s); int q; cin >> q; for(int a0 = 0; a0 < q; a0++){ int l; int r; cin >> l >> r; int result = answerQuery(l, r); cout << result << endl; } return 0; }