func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   bool chmax(T& a, const T& b) {     return a < b ? (a = b, true) : false;   }   template <typename T>   bool chmin(T& a, const T& b) {     return b < a ? (a = b, true) : false;   }   int N, Q;   const int MAX_N = 100000;   const int BUCKET = 100, SIZE = 1000;   char S[MAX_N + 17];   int bucketCnt[BUCKET][10][11][4];   int getId(char c) {     if (c ==  A ) return 0;     if (c ==  C ) return 1;     if (c ==  G ) return 2;     return 3;   }   void init() {     for (int i = (int)(0); i < (int)(N); i++) {       int bucketL = i / SIZE * SIZE;       for (int j = (int)(1); j < (int)(11); j++) {         bucketCnt[i / SIZE][(i - bucketL) % j][j][getId(S[i])]++;       }     }   }   void change(int idx, char c) {     int bucketL = idx / SIZE * SIZE;     for (int j = (int)(1); j < (int)(11); j++) {       bucketCnt[idx / SIZE][(idx - bucketL) % j][j][getId(S[idx])]--;     }     S[idx] = c;     for (int j = (int)(1); j < (int)(11); j++) {       bucketCnt[idx / SIZE][(idx - bucketL) % j][j][getId(S[idx])]++;     }   }   int getImpact(int l, int r, int M, char e[]) {     int res = 0;     for (int i = (int)(0); i < (int)(BUCKET); i++) {       int bucketL = i * SIZE, bucketR = min(N, (i + 1) * SIZE);       if (r <= bucketL || bucketR <= l) continue;       if (l <= bucketL && bucketR <= r) {         for (int j = (int)(0); j < (int)(min(M, bucketR - bucketL)); j++) {           int x = (bucketL + j - l) % M;           res += bucketCnt[i][j][M][getId(e[x])];         }         continue;       }       for (int j = (int)(max(bucketL, l)); j < (int)(min(bucketR, r)); j++) {         int x = (j - l) % M;         res += e[x] == S[j];       }     }     return res;   }   int main() {     scanf( %s , S);     N = strlen(S);     init();     scanf( %d , &Q);     for (int i = (int)(0); i < (int)(Q); i++) {       int t;       scanf( %d , &t);       if (t == 1) {         int x;         char c[17];         scanf( %d%s , &x, c);         x--;         change(x, c[0]);       } else {         int l, r;         char e[17];         scanf( %d%d%s , &l, &r, e);         l--;         int M = strlen(e);         printf( %d n , getImpact(l, r, M, e));       }     }     return 0;   }   