#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int countPalindrome(char *str) { int i,j,k,count=0; for(i=0;str[i];i++) { k=i-1;j=i+1; //count odd length palindromes while(k>=0 && str[j] && str[k]==str[j]) { ++count; k--;j++; } k=i;j=i+1; //count even length palindrome while(k>=0 && str[j] && str[k]==str[j]) { ++count; k--;j++; } } return count; } int main(){ int n; int q; cin >> n >> q; string s; cin >> s; for(int a0 = 0; a0 < q; a0++){ int t, i, j, p; cin >> t >> i >> j; if(t==1){ cin >> p; for(int k=i; k<=j; k++){ s[k] = (int)s[k]+p; } } else{ char s1[j-i]; int c=0; for(int k=i; k<=j; k++){ s1[c++] = s[k]; } cout << countPalindrome(s1) << endl; } } return 0; }