#include <bits/stdc++.h>
#include <iterator>
#include <unordered_set>
using namespace std;
int main() {
int result = 0;
string s("aybabtu");// cin >> s;
int n = s.length();
vector<int> points(n, 0);
unordered_set<char> seen;
auto left = s.begin();
auto right = left+1;
while (left < s.end()) {
int i = distance(s.begin(), right);
if (seen.count(*right) == 0 && right != s.end()) {
seen.insert(*right);
++points[i];
++right;
} else {
if (!seen.empty()) seen.clear();
++left;
seen.insert(*left);
right = left+1;
}
}
for (int i = 1; i < n; ++i) points[i]+=points[i-1]; // cumulative sum
seen.clear();
left = s.begin();
right = left+1;
vector<int> finals(n, 0);
while (left < s.end()) {
int i = distance(s.begin(), left);
int j = distance(s.begin(), right);
if (seen.count(*right) == 0 && right != s.end()) {
int p = 1;
if (i>1) {
p = points[i-1];
}
seen.insert(*right);
finals[j] += p;
++right;
} else {
if (!seen.empty()) seen.clear();
++left;
right = left+1;
seen.insert(*left);
}
}
for (int i = 1; i < n; ++i) finals[i]+=finals[i-1];
seen.clear();
for (int i = n-1; i > 0; --i) {
char val = s[i];
if (seen.count(val) != 0) break;
int p = finals[i-1]+1;
result += p+1;
seen.insert(val);
}
cout << result << endl;
}