using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { string inpt = Reader.ReadLine(); this.Text = inpt; dic = new Nullable[this.Text.Length]; long ans = GetAns(0); Console.WriteLine(ans); } private string Text; private Nullable[] dic; private long Mod = 1000000000 + 7; private long GetAns(int idx) { if(dic[idx] != null) { return dic[idx].Value; } long ans = 1; StringBuilder txt1 = new StringBuilder(); StringBuilder txt2 = new StringBuilder(); for (int i = 1; (idx+i)*2<=Text.Length; i++) { txt1.Append(Text[idx+i-1]); txt2.Insert(0, (Text[Text.Length - idx - i])); if(txt1.ToString().Equals(txt2.ToString())) { ans += GetAns(idx + i); ans = ans % Mod; } } dic[idx] = ans; return ans; } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" aaaaa "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }