func_code_string: #include <bits/stdc++.h>   using namespace std;   const int Max = 1e5 + 10;   int fw[Max][26];   int bw[Max][26];   int gs[Max][26];   int ge[Max][26];   int n;   int A[Max];   int mex(vector<int> vec);   void CalcGS(int i, int c);   void CalcGE(int i, int c);   int mex(vector<int> vec) {     sort(vec.begin(), vec.end());     if (vec[0] > 0) return 0;     for (int i = 1; i < vec.size(); i++)       if (vec[i] > vec[i - 1] + 1) return vec[i - 1] + 1;     return vec.back() + 1;   }   int G(int l, int r) {     if (l >= r) return 0;     if ((r - l) == 1 || (r - l) == 2 && A[l + 1] == A[r + 1]) return 1;     l++, r--;     for (int ch = 0; ch < 26; ch++) {       if (A[l] == ch && A[r] == ch) {         CalcGS(l + 1, ch);         CalcGS(r + 1, ch);       } else if (A[r] == ch) {         CalcGS(l, ch);         CalcGS(r + 1, ch);       } else if (A[l] == ch) {         int lCh = bw[r][ch];         CalcGS(l + 1, ch);         CalcGS(lCh + 1, ch);         CalcGE(r, ch);       } else {         int lCh = bw[r][ch];         if (lCh < l) continue;         CalcGS(l, ch);         CalcGS(lCh + 1, ch);         CalcGE(r, ch);       }     }     vector<int> vec;     for (int ch = 0; ch < 26; ch++) {       int g = 0;       if (A[l] == ch && A[r] == ch) {         g = gs[l + 1][ch] ^ gs[r + 1][ch];       } else if (A[r] == ch) {         g = gs[l][ch] ^ gs[r + 1][ch];       } else if (A[l] == ch) {         int lCh = bw[r][ch];         g = gs[l + 1][ch] ^ gs[lCh + 1][ch] ^ ge[r][ch];       } else {         int lCh = bw[r][ch];         if (lCh < l) continue;         g = gs[l][ch] ^ gs[lCh + 1][ch] ^ ge[r][ch];       }       vec.push_back(g);     }     return mex(vec);   }   void CalcGE(int i, int c) {     if (ge[i][c] >= 0) return;     if (A[i] == c) {       ge[i][c] = 0;       return;     }     int l = bw[i][c], r = i + 1;     ge[i][c] = G(l, r);   }   void CalcGS(int i, int c) {     if (gs[i][c] >= 0) return;     CalcGS(fw[i - 1][c] + 1, c);     if (A[i] == c) {       gs[i][c] = 0 ^ gs[fw[i - 1][c] + 1][c];       return;     }     int g = G(i - 1, fw[i - 1][c]) ^ gs[fw[i - 1][c] + 1][c];     gs[i][c] = g;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     {       string s;       cin >> s;       n = s.size();       for (int i = 0; i <= n; i++)         for (int ch = 0; ch < 26; ch++) gs[i][ch] = ge[i][ch] = -1;       for (int ch = 0; ch < 26; ch++) gs[0][ch] = gs[n + 1][ch] = 0;       for (int i = 0; i < n; i++) A[i + 1] = s[i] -  a ;       for (int ch = 0; ch < 26; ch++) {         int lastChSeen = n + 1;         for (int i = n; i--;) {           fw[i + 1][ch] = lastChSeen;           if (A[i + 1] == ch) lastChSeen = i + 1;         }         fw[0][ch] = lastChSeen;         lastChSeen = 0;         bw[0][ch] = lastChSeen;         for (int i = 0; i < n; i++) {           bw[i + 1][ch] = lastChSeen;           if (A[i + 1] == ch) lastChSeen = i + 1;         }       }     }     int q;     cin >> q;     while (q--) {       int l, r;       cin >> l >> r;       if (l == r) {         cout <<  Alice n ;         continue;       }       int g = G(l - 1, r + 1);       if (g == 0)         cout <<  Bob n ;       else         cout <<  Alice n ;     }   }   