#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ull = unsigned long long; using ll = long long; using ld = long double; #define all(v) v.begin(), v.end() #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep2(i, n, m) for (ll i = n; i <= m; ++i) #define rep3(i, n, m) for (ll i = n; i >= m; --i) template using pqg = priority_queue, greater>; template using pq = priority_queue; template inline bool chmax(S &a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(S &a, T b) { if (a > b) { a = b; return true; } return false; } constexpr int MOD = 1000000007; string s; int n; int memo[10005]; int dp(int l, int r) { if (r - l <= 1) return 1LL; if (memo[l] != -1) return memo[l]; int& ret = memo[l]; ret = 1; for (int l2 = l+1, r2 = r-1; l2 <= r2; ++l2, --r2) { if (s.substr(l, l2) == s.substr(r2, r)) { ret += dp(l2, r2); ret %= MOD; } } return ret; } int main() { cin >> s; n = s.size(); memset(memo, -1, sizeof(memo)); cout << dp(0, n) << endl; return 0; }