#include"iostream" #include"algorithm" #include"cstring" #include"cstdio" #include"cmath" #include"vector" #include"unordered_map" #include"cassert" #include"bitset" #include"queue" usingnamespace std; //#define int long long #define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i) #define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i) #define pii pair<int,int> #define fi first #define se second #define mp make_pair #define pb push_back #define eb emplace_back #define vi vector<int> #define all(x) (x).begin() , (x).end() #define mem( a ) memset( a , 0 , sizeof a ) #pragma GCC optimize(3) typedeflonglong ll; constint MAXN = 106; constint P = 998244353; int n; char S[MAXN]; int A[MAXN]; bitset<102> s;
unordered_map<bitset<102>,int> F[MAXN][MAXN]; intcalc( int l , int r , bitset<102> vec ){ if( l == r + 1 ) return1; if( F[l][r].count( vec ) ) { return F[l][r][vec]; } int ans = 0 , w = 1; if( judge( l , vec ) ) w = 2; ans = ( ans + w * 1ll * calc( l + 1 , r , vec ) ) % P; auto vv = vec; rep( len , 1 , ( r - l + 1 ) / 2 ) { int cc = 0; for( int k = 1 ; ( k + 1 ) * len + l - 1 <= r ; ++ k ) { vv |= vv << len; ans = ( ans + calc( l , l + len - 1 , vv ) * 1ll * calc( l + len * ( k + 1 ) , r , vec ) ) % P; } vv = vec; } return F[l][r][vec] = ans; }
voidsolve(){ scanf("%s",S + 1); n = strlen( S + 1 ); rep( i , 1 , n ) A[i] = S[i] - '0' , s[i] = A[i]; bitset<102> ii; ii.set( 0 ); cout << calc( 1 , n , ii ) << endl; // rep( i , 1 , n ) rep( j , i , n ) { // cout << i << ' ' << j << ' ' << pr[i][j] << endl; // } // cout << pp << endl; }