import sys readline=sys.stdin.readline import random class Rolling_Hash: def __init__(self,lst,base,mod): self.len=len(lst) self.base=base self.mod=mod self.rolling_hash=[None]*(self.len+1) self.rolling_hash[0]=0 x=1 for i in range(1,self.len+1): self.rolling_hash[i]=self.rolling_hash[i-1]+x*lst[i-1] self.rolling_hash[i]%=self.mod x*=self.base x%=self.mod x=pow(x,self.mod-2,self.mod) self.base_reverse=[None]*(self.len+1) self.base_reverse[self.len]=x for i in range(self.len-1,-1,-1): self.base_reverse[i]=self.base_reverse[i+1]*self.base%self.mod def __getitem__(self,i): if type(i)==int: a,b=i,i+1 else: a,b=i.start,i.stop if a==None or a<-self.len: a=0 elif self.len<=a: a=self.len elif a<0: a+=self.len if b==None or self.len<=b: b=self.len elif b<-self.len: b=0 elif b<0: b+=self.len return (self.rolling_hash[b]-self.rolling_hash[a])*self.base_reverse[a]%self.mod def __len__(self): return self.len S=readline().rstrip() N=len(S) base=random.randint(1<<50,1<<51) S=Rolling_Hash([ord(s) for s in S],base,(1<<61)-1) mod=10**9+7 dp=[0]*(N//2+1) for i in range(N//2,-1,-1): dp[i]+=1 dp[i]%=mod for j in range(i+1,N//2+1): if S[i:j]==S[N-j:N-i]: dp[i]+=dp[j] dp[i]%=mod ans=dp[0] print(ans)