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