#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans;
  int be, af;
  int af_0 = 100001;
  string s;
  cin >> s;
  be = s.size();
  do {
    if (s.find("01") > 100001) break;
    s.erase(s.find("01"), s.find("01") + 1);
    if (s == "01") af_0 = 0;
  } while (true);
  af = s.size();
  af = min(af, af_0);
  ans = be - af;
  cout << ans << endl;
  return (0);
}
