#include <iostream>
#include <cmath>
#include <vector>
#include <iostream>
#include <cmath>
#include <vector>
#if 0
int main()
{
std::string s;
std::cin >> s;
// How many combinations of multiplications can be put inside of the given range. First 2 numbers aren't needed but I'm too lazy to optimize it
uint64_t* combinations = new uint64_t[s.size()]();
uint64_t* sums = new uint64_t[s.size()]();
for (uint64_t i = 0; i < s.size(); i++)
{
bool letters[26] = {};
letters[s[i] - 'a'] = true;
for (uint64_t j = i + 1; j < s.size(); j++)
{
if (letters[s[j] - 'a'])
break;
letters[s[j] - 'a'] = true;
uint64_t left = i;
uint64_t right = j;
uint64_t lastTotal = 0;
if (left)
{
for (int j = left - 1; j != 0; j--)
{
if (sums[j])
{
lastTotal = sums[j];
break;
}
}
}
lastTotal %= 1000000007;
combinations[right] += 1 + lastTotal;
combinations[right] %= 1000000007;
sums[left] = lastTotal + combinations[left];
sums[left] %= 1000000007;
}
}
uint64_t count = 1;
for (uint64_t i = 1; i < s.size(); i++)
{
if (combinations[i])
{
count += combinations[i];
count = count % 1000000007;
}
}
std::cout << count;
delete[] combinations;
delete[] sums;
}
#else
int main()
{
std::string s;
std::cin >> s;
// How many combinations of multiplications can be put inside of the given range. First 2 numbers aren't needed but I'm too lazy to optimize it
uint64_t* combinations = new uint64_t[s.size()]();
uint64_t* sums = new uint64_t[s.size()]();
for (uint64_t i = 0; i < s.size(); i++)
{
bool letters[26] = {};
letters[s[i] - 'a'] = true;
for (uint64_t j = i + 1; j < s.size(); j++)
{
if (letters[s[j] - 'a'])
break;
letters[s[j] - 'a'] = true;
uint64_t left = i;
uint64_t right = j;
uint64_t lastTotal = 0;
if (left)
{
if (sums[left])
lastTotal = sums[left];
else
{
for (int j = left - 1; j != 0; j--)
{
lastTotal += combinations[j];
}
sums[left] = lastTotal;
}
}
combinations[right] += 1 + lastTotal;
combinations[right] = combinations[right] % 1000000007;
}
}
uint64_t count = 1;
for (uint64_t i = 1; i < s.size(); i++)
{
if (combinations[i])
{
count += combinations[i];
count = count % 1000000007;
}
}
std::cout << count;
}
#endif
/*
EXAMPLES FOR TESTING
A B A C
A B AC
A BA C
A BAC
AB A C
AB AC
A Y B A
A Y BA
A YB A
A YBA
AY B A
AY BA
AYB A
A Y B A B 1
A Y B AB 2
A Y BA B 3
A YB A B 4
A YB AB 5
A YBA B 6
AY B A B 7
AY B AB 8
AY BA B 9
AYB A B 10
AYB AB 11
*/