#include <bits/stdc++.h>
using namespace std;
int main(void) {
  regex re("01|10");
  string S;
  cin >> S;
  string org_S = S;
  while (true) {
    if (regex_search(S, re)) {
      S = regex_replace(S, re, "");
    } else {
      break;
    }
  }
  cout << org_S.size() - S.size() << endl;
  return 0;
}
