mod = 10**9+7 def main(): S = str(input()) S = [ord(c)-ord('a') for c in S] n = len(S) dp = [[0, 0] for i in range(26)] #dp[c][0]: 最後がcの文字列の個数 #dp[c][1]: 最後がcの文字列の連の和 ans = 0 for i, c in enumerate(S): if i == 0: dp[c][0] = 1 dp[c][1] = 1 continue nx = [[0, 0] for j in range(26)] nx[c][0] = 1 nx[c][1] = 1 # i番目の文字列を選ばない場合 for j in range(26): nx[j][0] += dp[j][0] nx[j][0] %= mod nx[j][1] += dp[j][1] nx[j][1] %= mod # i番目の文字列を選ぶ場合 for j in range(26): if j == c: nx[j][0] += dp[j][0] nx[j][0] %= mod nx[j][1] += dp[j][1] nx[j][1] %= mod else: nx[c][0] += dp[j][0] nx[c][0] %= mod nx[c][1] += dp[j][0]+dp[j][1] nx[c][1] %= mod dp = nx ans = 0 for j in range(26): ans += dp[j][1] ans %= mod print(ans) if __name__ == '__main__': main()