#include using namespace std; using ll = long long; const ll MOD = 1000000007; string s; int n; ll dp[10005]; ll solve(int cur) { if (cur >= n / 2) return 0; if (dp[cur] >= 0) return dp[cur]; ll res = 1; string sl = "", sr = ""; for (int i = cur; i < n / 2; i++) { sl += s[i]; sr = s[n - 1 - i] + sr; if (i > cur && (sl.front() != s[n - 1 - i] || sr.back() != s[i])) continue; (res += solve(i + 1)) %= MOD; } return dp[cur] = res; } int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> s; n = s.length(); dp[(n - 1) / 2] = 1; if (n % 2 == 0) dp[(n - 1) / 2] += (s[(n - 1) / 2] == s[(n - 1) / 2 + 1]); for (int i = (n - 1) / 2 - 1; i >= 0; i--) { dp[i] = 1; string sl = "", sr = ""; for (int j = i + 1; j <= (n - 1) / 2; j++) { sl += s[j - 1]; sr = s[n - j] + sr; if (sl == sr) (dp[i] += dp[j]) %= MOD; } } cout << dp[0] << endl; return 0; }