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