#include using namespace std; int lps(string str) { int n = str.length(); int i, j, cl; int L[n][n]; for (i = 0; i < n; i++) L[i][i] = 1; for (cl=2; cl<=n; cl++) { for (i=0; i> s; int q; cin >> q; for(int a0 = 0; a0 < q; a0++){ int l; int r; cin >> l >> r; string p=s.substr(l-1,r-l); int result = answerQuery(p); cout << result << endl; } return 0; }