aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

#include <bits/stdc++.h>
using namespace std;
char s[100001];
int a[100001];
int main() {
  int sum = 0, len, i, j;
  while (cin >> s) {
    memset(a, 0, sizeof(a));
    sum = 0;
    len = strlen(s);
    for (i = 0; i < len; i++) {
      if (s[i] == 'a') a[i] = 1;
      for (j = 0; j < i; j++) {
        if (s[j] == s[i] - 1) a[i] += a[j];
      }
      sum += a[i];
    }
    cout << sum << endl;
  }
  return 0;
}
