from array import array
string = input()
length = len(string)
symbols = {string[0]: 0}
index_of_preceding = array('l', [-1] * length)
number_for_symbol = array('l', [1] * length)
rightest_ntl = str()
prime_modulus = 1000000007
def extra(x, y):
global index_of_preceding
global number_for_symbol
index_of_rightest_ntl = -1
for i in range(x + 1, y):
if index_of_preceding[i] > index_of_rightest_ntl:
index_of_rightest_ntl = index_of_preceding[i]
if index_of_rightest_ntl > x:
return 0
elif index_of_rightest_ntl == -1:
return number_for_symbol[x]
else:
return number_for_symbol[x] - extra(index_of_rightest_ntl, x + 1)
start = length
for i in range(1, length):
if string[i] in symbols:
index_of_preceding[i] = symbols[string[i]]
number_for_symbol[i] = 2 ** i - number_for_symbol[index_of_preceding[i]]
symbols[string[i]] = i
rightest_ntl = string[i]
start = i + 1
break
else:
number_for_symbol[i] = 2 ** i
symbols[string[i]] = i
for i in range(start, length):
if string[i] in symbols:
index_of_preceding[i] = symbols[string[i]]
number_for_symbol[i] = 2 * number_for_symbol[i - 1] - extra(index_of_preceding[i], i)
rightest_ntl = string[i]
symbols[string[i]] = i
if not 0 <= number_for_symbol[i] < prime_modulus:
number_for_symbol[i] %= prime_modulus
else:
number_for_symbol[i] = 2 * number_for_symbol[i - 1]
symbols[string[i]] = i
if number_for_symbol[i] >= prime_modulus:
number_for_symbol[i] %= prime_modulus
print(number_for_symbol[length - 1])