func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     string s;     cin >> s;     long long n = s.length();     s =  1  + s;     long long x[n + 1], y[n + 1], z[n + 1];     x[0] = 0;     y[0] = 0;     z[0] = 0;     for (long long i = 1; i <= n; i++) {       x[i] = x[i - 1];       y[i] = y[i - 1];       z[i] = z[i - 1];       if (s[i] ==  x ) x[i]++;       if (s[i] ==  y ) y[i]++;       if (s[i] ==  z ) z[i]++;     }     long long m;     cin >> m;     for (long long i = 0; i < m; i++) {       long long l, r;       cin >> l >> r;       long long len = r - l + 1;       long long cx = x[r] - x[l - 1];       long long cy = y[r] - y[l - 1];       long long cz = z[r] - z[l - 1];       if (len < 3) {         cout <<  YES  <<   n ;         continue;       }       if (abs(cx - cy) > 1 || abs(cx - cz) > 1 || abs(cz - cy) > 1)         cout <<  NO  <<   n ;       else         cout <<  YES  <<   n ;     }   }   