#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  int c = 0;
  for (int i = 0; i < n - 1; i++) {
    if (abs(s[i] - s[i + 1]) == 1) {
      c += 2;
      for (int j = i; j < n - 2; j++) {
        s[j] = s[j + 2];
      }
      n -= 2;
      i = 0;
    }
  }
  if (abs(s[0] - s[1]) == 1) c += 2;
  cout << c << endl;
}
