#include <iostream>
#include <cmath>
#include <vector>
int main()
{
std::string s;
std::cin >> s;
struct Multiplication
{
uint32_t left, right;
};
std::vector<Multiplication> Multiplications;
for (uint32_t i = 0; i < s.size(); i++)
{
bool letters[26] = {};
letters[s[i] - 'a'] = true;
for (uint32_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
uint32_t* combinations = new uint32_t[s.size()]();
for (uint32_t i = 0; i < Multiplications.size(); i++)
{
uint32_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;
}
uint32_t count = 1;
for (uint32_t i = 1; i < s.size(); i++)
{
count += combinations[i];
}
std::cout << count;
//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
*/