/* -*- coding: utf-8 -*- * * 599.cc: No.599 回文かい - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 10000; const int MAX_HN = MAX_N / 2; const int MOD = 1000000007; /* typedef */ typedef long long ll; /* global variables */ ll dp[MAX_HN + 1]; /* subroutines */ bool kaibunkai(string &s, int n, int i, int j) { for (int i0 = i, i1 = n - j; i0 < j; i0++, i1++) if (s[i0] != s[i1]) return false; return true; } /* main */ int main() { string s; cin >> s; int n = s.size(), hn = n / 2; fill(dp, dp + hn + 1, 1); for (int i = hn - 1; i >= 0; i--) for (int j = i + 1; j <= hn; j++) if (kaibunkai(s, n, i, j)) dp[i] = (dp[i] + dp[j]) % MOD; printf("%lld\n", dp[0]); return 0; }