func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   char s[1010];   int n, fa[2010], val[2010], pw2[2010], ans = 0;   inline int getf(int x) {     if (x == fa[x]) return x;     int f = getf(fa[x]);     val[x] ^= val[fa[x]];     fa[x] = f;     return f;   }   inline int merge(int x, int y, int w) {     int ti = getf(x), tj = getf(y);     if (ti == tj) return w == (val[x] ^ val[y]);     w ^= val[x] ^ val[y];     fa[ti] = tj;     val[ti] = w;     return 1;   }   int main() {     scanf( %s , s + 1);     n = strlen(s + 1);     reverse(s + 1, s + n + 1);     pw2[0] = 1;     for (int i = 1; i <= n; i++) pw2[i] = (pw2[i - 1] + pw2[i - 1]) % mod;     int ans = 0;     for (int lena = n - 1; lena >= 1; lena--) {       for (int j = 1; j <= ((n << 1) + 1); j++) fa[j] = j, val[j] = 0;       if (!merge((n), ((n << 1) + 1), 0)) continue;       if (!merge((n + n), ((n << 1) + 1), 1)) continue;       bool fail = 0;       for (int j = 1; j <= n / 2; j++) {         if (!merge((j + n), (n + 1 - j + n), 0)) {           fail = 1;           break;         }       }       if (fail) continue;       for (int j = 1; j <= lena / 2; j++) {         if (!merge((j), (lena + 1 - j), 0)) {           fail = 1;           break;         }       }       if (fail) continue;       for (int j = lena + 1; j < n; j++) {         if (!merge((j), ((n << 1) + 1), 0)) {           fail = 1;           break;         }       }       if (!merge((lena), ((n << 1) + 1), 1)) fail = 1;       if (fail) continue;       for (int j = 1; j <= n; j++) {         if (s[j] ==  0 ) {           if (!merge((j), (j + n), 0)) {             fail = 1;             break;           }         } else if (s[j] ==  1 ) {           if (!merge((j), (j + n), 1)) {             fail = 1;             break;           }         }       }       if (fail) continue;       int cnt = 0;       for (int j = 1; j <= ((n << 1) + 1); j++)         if (getf(j) == j && getf(j) != getf(((n << 1) + 1))) cnt++;       ans = (ans + pw2[cnt]) % mod;     }     printf( %d n , ans);     return 0;   }   