#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int tot = 0;
  int st = 0;
  int ind = 0;
  int siz = str.size();
  while (ind < siz) {
    if (st == 0) {
      if (str[ind] == '0') {
        ind++;
        continue;
      }
      int cnt = 0;
      while (ind < siz) {
        if (str[ind] == '0') {
          ind++;
          if (cnt > 1) st = 1;
          break;
        }
        ind++;
        cnt++;
      }
      if (cnt > 1)
        tot += 2;
      else {
        st = 0;
        if (cnt > 0) tot++;
      }
    } else if (st == 1) {
      if (str[ind] == '0') {
        st = 0;
        ind++;
        continue;
      }
      int cnt = 0;
      while (ind < siz) {
        if (str[ind] == '0') {
          ind++;
          break;
        }
        ind++;
        cnt++;
      }
      if (cnt > 0) tot++;
    }
  }
  cout << tot << endl;
  return 0;
}
