#include <iostream>
#include <cmath>
#include <vector>
int main()
{
std::string s;
std::cin >> s;
struct Multiplication
{
uint64_t left, right;
};
std::vector<Multiplication> Multiplications;
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;
Multiplications.push_back({ i, j });
letters[s[j] - 'a'] = true;
}
}
// 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()]();
for (uint64_t i = 0; i < Multiplications.size(); i++)
{
uint64_t lastTotal = 0;
if (Multiplications[i].left)
{
for (int j = Multiplications[i].left - 1; j != 0; j--)
{
lastTotal += combinations[j];
}
}
combinations[Multiplications[i].right] += 1 + lastTotal;
}
uint64_t count = 1;
for (uint64_t i = 1; i < s.size(); i++)
{
count += combinations[i];
}
std::cout << count%(1000000009);
//for (auto& m : Multiplications)
//{
// std::cout << m.pos << " " << m.len << "\n";
//}
}
/*
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
*/