#include using namespace std; string str; void initialize(string s) { // This function is called once before all queries. str=s; } int answerQuery(int l, int r) { // Return the answer for this query modulo 1000000007. string str1= str.substr(l-1,r); vector count(26,0); int i,maxi=0; for(i=0;i> 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; }