#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  stack<char> stck;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    char ch;
    if (stck.empty()) {
      ch = s[0];
    } else {
      ch = stck.top();
    }
    if (ch != s[i]) {
      stck.pop();
    } else {
      stck.push(s[i]);
    }
  }
  cout << s.size() - stck.size() << endl;
  return 0;
}
