import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; const long MOD = 10^^9 + 7; void main() { auto S = readln.chomp; auto N = S.length.to!int; int[][string] hoge; foreach (i; 0..N) foreach (j; i+1..N+1) hoge[S[i..j]] ~= i; auto mem = new long[](N); mem.fill(-1); long dfs(int l) { if (l >= N/2) return 0; if (mem[l] >= 0) return mem[l]; int r = N - l - 1; long ret = 0; foreach (i; l..N/2) { if (S[l..i+1] in hoge && !(hoge[S[l..i+1]].assumeSorted.equalRange(N-i-1).empty)) { (ret += dfs(i+1) + 1) %= MOD; } } mem[l] = ret; return ret; } writeln(dfs(0)+1); }