import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static long P = 1000003; public static long MOD = 1000000007; public static long[] rolling_hash(char[] ins){ long[] hash = new long[ins.length]; hash[0] = ins[0]; for(int i = 1; i < ins.length; i++){ hash[i] = hash[i - 1] * P; hash[i] %= MOD; hash[i] += ins[i]; hash[i] %= MOD; } return hash; } public static long mod_pow(long a, long p){ if(p == 0){ return 1; } if(p == 1){ return a % MOD; } if(p % 2 == 1){ return (mod_pow(a, p - 1) * a) % MOD; }else{ final long ret = mod_pow(a, p / 2) % MOD; return (ret * ret) % MOD; } } public static long calc_hash(long[] hash, int begin, int end){ final long from_end = hash[end - 1]; final long from_begin = (hash[begin] * mod_pow(P, (end - begin) - 1)) % MOD; return (MOD + (from_end - from_begin)) % MOD; } public static long dfs(int offset, char[] ins, long[] memo, long[] hash){ if(memo[offset] >= 0){ return memo[offset]; } long ret = 1; LOOP: for(int len = 1; ;len++){ final int fst_begin = offset; final int snd_end = ins.length - offset; final int snd_begin = snd_end - len; final int fst_end = fst_begin + len; if(fst_end > snd_begin){ break; } /* System.out.println(fst_begin + " " + snd_begin + " " + len); System.out.println("[" + fst_begin + ", " + fst_end + "]"); //*/ /* for(int i = 0; i < len; i++){ final int fst = fst_begin + i; final int snd = snd_begin + i; if(ins[fst] != ins[snd]){ continue LOOP; } } //*/ if(len != 1){ final long fst_hash = calc_hash(hash, fst_begin, fst_end); final long snd_hash = calc_hash(hash, snd_begin, snd_end); //System.out.println(fst_hash + " " + snd_hash); if(fst_hash != snd_hash){ continue; } }else if(ins[fst_begin] != ins[snd_begin]){ continue; } //System.out.println(offset + " " + fst_begin + " " + snd_begin + " " + len); ret += dfs(offset + len, ins, memo, hash); ret %= MOD; } return memo[offset] = ret; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final char[] ins = sc.next().toCharArray(); long[] memo = new long[ins.length]; Arrays.fill(memo, -1); System.out.println(dfs(0, ins, memo, rolling_hash(ins))); } }