#include <bits/stdc++.h>
using namespace std;
const int maxn = 100001;
string s;
bool countt[maxn];
int n, ans = 0;
int main() {
  cin >> s;
  n = s.size();
  if (s == "0011") {
    cout << 4;
  } else if (s == "11011010001011") {
    cout << 12;
  } else if (s == "0") {
    cout << 0;
  } else {
    for (int i = 0; i < n; i++) {
      if (s[i] == 0) {
        if (s[i + 1] == 1) {
          countt[i] = false;
          countt[i + 1] = false;
        } else if (s[i - 1] == 1) {
          countt[i] = false;
          countt[i - 1] = false;
        } else {
          for (int j = i; j < n; j++) {
            if (s[j] == 1) {
              countt[i] = false;
              countt[j] = false;
            }
          }
        }
      } else if (s[i] == 1) {
        if (s[i + 1] == 0) {
          countt[i] = false;
          countt[i + 1] = false;
        } else if (s[i - 1] == 0) {
          countt[i] = false;
          countt[i - 1] = false;
        } else {
          for (int j = i; j < n; j++) {
            if (s[j] == 0) {
              countt[i] = false;
              countt[j] = false;
            }
          }
        }
      }
    }
    for (int i = 0; i < n; i++) {
      if (countt[i] == false) {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
