func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 1000000000 + 7;   const int N = 200000 + 10;   const int NUMHASH = 3;   const long long hashNum[3] = {M, M + 2, M + 14};   struct re {     int x, y;   };   int n, q;   string s;   int cnt[26][N], f[26][N], g[26][N];   long long h[NUMHASH][26][N], p[NUMHASH][N];   int countLetter(int x, int y, int c) { return cnt[c][x] - cnt[c][y + 1]; }   int getHash(int x, int l, int c, int k) {     return (h[k][c][x + l - 1] - (h[k][c][x - 1] * p[k][l] % hashNum[k]) +             hashNum[k]) %            hashNum[k];   }   bool equalHash(int x, int i, int y, int j, int l) {     for (int k = (0); (k <= (NUMHASH - 1)); ++k) {       if (getHash(x, l, i, k) != getHash(y, l, j, k)) return false;     }     return true;   }   bool iso(int x, int y, int l) {     for (int i = (0); (i <= (25)); ++i) {       int pos = f[i][x];       if (pos < l) {         int j = s[y - 1 + pos] -  a ;         if (f[j][y] != pos) return false;         if (countLetter(x, x + l - 1, i) != countLetter(y, y + l - 1, j))           return false;         if (!equalHash(x, i, y, j, l)) return false;       }     }     return true;   }   int main() {     cin >> n >> q;     cin >> s;     for (int i = (n); (i >= (1)); --i) {       for (int j = (0); (j <= (25)); ++j)         cnt[j][i] = cnt[j][i + 1], f[j][i] = f[j][i + 1] + 1;       int j = s[i - 1] -  a ;       cnt[j][i] = cnt[j][i + 1] + 1;       f[j][i] = 0;       g[j][i] = 1;     }     for (int k = (0); (k <= (NUMHASH - 1)); ++k) {       p[k][0] = 1;       for (int i = (1); (i <= (n)); ++i) p[k][i] = (p[k][i - 1] * 2) % hashNum[k];       for (int j = (0); (j <= (25)); ++j) {         for (int i = (1); (i <= (n)); ++i)           h[k][j][i] = (h[k][j][i - 1] * 2 + g[j][i]) % hashNum[k];       }     }     while (q--) {       int x, y, len;       cin >> x >> y >> len;       if (iso(x, y, len))         cout <<  YES ;       else         cout <<  NO ;       cout << endl;     }   }   