func_code_string: #include <bits/stdc++.h>   using namespace std;   int Set(int N, int pos) { return N |= (1LL << pos); }   int Reset(int N, int pos) { return N &= ~(1LL << pos); }   bool Check(int N, int pos) { return N & (1LL << pos); }   int dx[] = {0, 0, 1, -1, 1, -1, 1, -1}, dy[] = {1, -1, 0, 0, 1, -1, -1, 1};   inline void cn(long &n) {     n = 0;     long ch = getchar();     int sign = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) sign = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 )       n = (n << 3) + (n << 1) + ch -  0 , ch = getchar();     n = n * sign;   }   template <class T>   void cmin(T &a, T b) {     if (b < a) a = b;   }   template <class T>   void cmax(T &a, T b) {     if (b > a) a = b;   }   template <class T>   int len(const T &c) {     return (int)c.size();   }   template <class T>   int len(char c[]) {     return (int)strlen(c);   }   string itos(long n) {     string s;     while (n) {       s += (n % 10 + 48);       n /= 10;     }     reverse(s.begin(), s.end());     return s;   }   long stoi(string s) {     long n = 0;     for (int i(0), _n(len(s)); i < _n; ++i) n = n * 10 + (s[i] - 48);     return n;   }   int ar[100005][3];   int main() {     string s, second;     int q, l, r, x, y, z, m;     cin >> s;     for (int i(0), _n(len(s)); i < _n; ++i) {       ar[i + 1][0] = ar[i][0];       ar[i + 1][1] = ar[i][1];       ar[i + 1][2] = ar[i][2];       ar[i + 1][s[i] -  x ]++;     }     cin >> q;     for (int i(0), _n(q); i < _n; ++i) {       cin >> l >> r;       x = ar[r][0] - ar[l - 1][0];       y = ar[r][1] - ar[l - 1][1];       z = ar[r][2] - ar[l - 1][2];       int sr[3];       sr[0] = x;       sr[1] = y;       sr[2] = z;       sort(sr, sr + 3);       if (sr[2] - sr[0] <= 1 || (r - l) < 2)         cout <<  YES n ;       else         cout <<  NO n ;     }     return 0;   }   