#include <bits/stdc++.h>
using namespace std;
string::size_type find01(string S) { return S.find(string("01")); }
string::size_type find10(string S) { return S.find(string("10")); }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S;
  cin >> S;
  int N = S.length();
  while (find01(S) != string::npos) {
    S.erase(find01(S), 2);
  }
  while (find10(S) != string::npos) {
    S.erase(find10(S), 2);
  }
  cout << N - S.length() << endl;
  return 0;
}
