#include using namespace std; void swap(char *a, char *b) { char temp; temp = *a; *a = *b; *b = temp; } vector print(char *a, int i, int n) { vector f; int j; if(i == n) { f.push_back(a); } else { for(j = i; j <= n; j++) { swap(a + i, a + j); print(a, i + 1, n); swap(a + i, a + j); } } return f; } int answerQuery(int l, int r, string s) { // Return the answer for this query modulo 1000000007. //so we calculate the difference btw l and r int diff = r-l+1; //take the string string for_query=s.substr(l-1,r); long long answer=0; //calculate all the ones that have 2 or more frequency as 1 vector allDiffChars; int alphabet[26];//counts nb of each /*for(int i=0;i<26;i++) alphabet[i]=0; for(int i=0;i values=print(a,0,len); //now take 1 char less for palindromes for(int i=0;i> s; int q; cin >> q; for(int a0 = 0; a0 < q; a0++){ int l; int r; cin >> l >> r; int result = answerQuery(l, r, s); cout << result << endl; } return 0; }