func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long int;   using ii = pair<ll, ll>;   using vi = vector<int>;   using vii = vector<ii>;   using graph = vector<vii>;   const int INF = 0x3f3f3f3f;   const ll INFL = 0x3f3f3f3f3f3f3f3f;   const int MAXN = 2123;   const ll mod = 998244353;   int seen[MAXN], color[MAXN];   string s;   graph g;   bool dfs(int u) {     seen[u] = 1;     int v, type;     for (auto k : g[u]) {       tie(v, type) = k;       if (!seen[v]) {         if (color[v] == -1) color[v] = color[u] ^ type;         if (dfs(v)) return 1;       }       if (color[v] ^ color[u] != type) return 1;     }     return 0;   }   void build(int n) {     for (int i = 0; i < n; ++i) {       seen[i] = 0;       color[i] = -1;     }     color[0] = 0;     color[1] = 1;   }   ll bxp(int xp) {     ll ans = 1, base = 2;     while (xp > 0) {       if (xp & 1) ans = ans * base % mod;       base = base * base % mod;       xp >>= 1;     }     return ans;   }   int main() {     int n, m;     cin >> s;     n = s.size();     ll ans = 0;     for (int k = n - 1; k > 0; --k) {       g.assign(2 + n + k + 1, vii());       for (int i = 2 + n, j = 2 + n + k - 1; i < j; ++i, --j) {         g[i].emplace_back(j, 0);         g[j].emplace_back(i, 0);       }       for (int i = 2, j = 2 + n - 1; i < j; ++i, --j) {         g[i].emplace_back(j, 0);         g[j].emplace_back(i, 0);       }       for (int i = 0, j = 0; i < n; ++i) {         if (s[i] ==  ? ) {           if (i >= n - k) ++j;           continue;         }         if (i < n - k) {           g[i + 2].emplace_back(s[i] -  0 , 0);           g[s[i] -  0 ].emplace_back(i + 2, 0);         } else {           g[i + 2].emplace_back(j + 2 + n, s[i] -  0 );           g[j + 2 + n].emplace_back(i + 2, s[i] -  0 );           ++j;         }       }       build(2 + n + k);       g[1].emplace_back(0, 1);       g[0].emplace_back(1, 1);       g[n + 2].emplace_back(1, 0);       g[1].emplace_back(n + 2, 0);       if (dfs(0)) {         continue;       }       int cnt = 0;       bool skip = 0;       for (int i = 2; i < 2 + n + k && !skip; ++i) {         if (!seen[i]) {           color[i] = 0;           if (dfs(i)) {             skip = 1;           }           ++cnt;         }       }       if (skip) continue;       ans += bxp(cnt);       if (ans >= mod) ans -= mod;     }     cout << ans <<   n ;   }   