#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  vector<long long> v(2, 0);
  for (long long(i) = 0; i < (s.size()); ++(i)) v[s[i]]++;
  if (v[0] == 0 || v[1] == 0)
    cout << (0) << endl;
  else
    cout << (abs(v[0] - v[1])) << endl;
  return 0;
}
