#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char p = 's';
  int num = 0, n = s.size(), f = 1, pi = 0;
  while (f) {
    f = 0;
    for (int i = 0; i < n; i++) {
      if (s.at(i) == '-') continue;
      if (s.at(i) != p && p != 's') {
        s.at(pi) = '-';
        s.at(i) = '-';
        num++;
        f = 1;
        p = 's';
        continue;
      }
      p = s.at(i);
      pi = i;
    }
  }
  cout << num * 2 << endl;
}
