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