func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int rdi() {     int d;     scanf( %d , &d);     return d;   }   inline char rdc() {     scanf(   );     return getchar();   }   inline string rds() {     string s;     cin >> s;     return s;   }   inline double rddb() {     double d;     scanf( %lf , &d);     return d;   }   template <class T>   inline bool setmin(T& a, T b) {     return a > b ? a = b, true : false;   }   template <class T>   inline bool setmax(T& a, T b) {     return a < b ? a = b, true : false;   }   struct debugger {     template <typename T>     debugger& operator,(const T& x) {       cerr << x <<  , ;       return *this;     }   } dbgr;   const int N = 131072, M = 128;   char s[N];   int n, c[3], cnt[N][3];   int Abs(int x) { return x < 0 ? -x : +x; }   int main() {     scanf( %s , s + 1), n = strlen(s + 1);     for (int i = (1); i <= (n); ++i)       memcpy(cnt[i], cnt[i - 1], sizeof cnt[i]), ++cnt[i][s[i] -  x ];     for (int repp_b = (rdi()), repp = 0; repp < repp_b; ++repp) {       int l = rdi(), r = rdi();       for (int i = (0); i < (3); ++i) c[i] = cnt[r][i] - cnt[l - 1][i];       int mx = *max_element(c, c + 3);       int mn = *min_element(c, c + 3);       puts(r - l + 1 < 3 || mx - mn <= 1 ?  YES  :  NO );     }     return 0;   }   