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