#include #include #include #include #include #include #include /*void initialize(char* s) { // This function is called once before all queries. } */ int ind(char a,char *p) { int i=0; while(1) { if(a==p[i]) break; i++; } return i; } int coun(char a,char* p) { int cn=0,i=0; while(p[i]!='\0') { if(p[i]==a) cn++; i++; } return cn; } int answerQuery(int l, int r,char *s) { // Return the answer for this query modulo 1000000007. long cn=0; int re; int e=r-l,q=0; int a[e]; for(int i=l;i<=r;i++) { if(ind(s[i],s)==i) { a[q]=coun(s[i],s); q++; } } if((r-l)%2==0) { int su=0; for(int i=0;i