S=[ord(s)-97 for s in input()] M=26 mod=10**9+7 dp0=[0]*M dp1=[0]*M for s in S: prev0=dp0[:] prev1=dp1[:] dp0[s]+=1 dp1[s]+=1 for t in range(26): dp0[s]+=prev0[t] dp1[s]+=prev1[t] if s!=t: dp1[s]+=prev0[t] dp0[s]%=mod dp1[s]%=mod ans=sum(dp1)%mod print(ans)