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