#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  int i;
  for (i = 0; i < s.length() + 1; i++) {
    if (i + 1 < s.length()) {
      if (s.at(i) != s.at(i + 1)) {
        s.erase(i, 2);
        i = max(i - 2, 0);
        count += 2;
      }
    }
  }
  if (s.length() == 2) {
    if (s.at(0) != s.at(1)) {
      count += 2;
    }
  }
  cout << count << endl;
  return 0;
}
