#include <bits/stdc++.h>
using namespace std;
int main() {
  int cnt = 0;
  int cnt_tmp = 0;
  int rep = 1;
  int j = 0;
  string s;
  cin >> s;
  string q;
  q = "";
  while (1) {
    for (int i = 1; i < s.length(); i++) {
      if (abs(s[i] - s[i - 1]) == 1) {
        s.erase(i - 1, 2);
        cnt += 2;
      }
    }
    if (cnt_tmp == cnt) break;
    cnt_tmp = cnt;
  }
  cout << cnt << endl;
  return 0;
}
