#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int leng_s;
  leng_s = s.size();
  int g;
  g = (leng_s / 2);
  for (int i = 0; i < g; i++) {
    s = regex_replace(s, regex("01"), "");
    s = regex_replace(s, regex("10"), "");
  }
  s = regex_replace(s, regex("01"), "");
  s = regex_replace(s, regex("10"), "");
  int leng_end_s;
  leng_end_s = s.size();
  int ans;
  ans = (leng_s - leng_end_s);
  cout << ans << endl;
}
