#include <bits/stdc++.h>
using namespace std;
int MAX = 1000000;
int MIN = -1000000;
int INF = 1000000000;
int x4[4] = {0, 1, 0, -1};
int y4[4] = {1, 0, -1, 0};
int x8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int y8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int i, j, k;
int main() {
  string str;
  cin >> str;
  str.push_back('0');
  reverse(str.begin(), str.end());
  str.push_back('0');
  int indx = 1, ans = 1;
  while (indx < str.size()) {
    if (str[indx] == '1' && str[indx + 1] == '1') {
      str[indx - 1] = '1';
      for (i = indx; str[i] == '1'; i++) str[i] = '0';
      str[i] = '1';
      indx = i;
    } else
      indx++;
  }
  int satu = 0;
  for (i = (0); i < (str.size()); i++) satu += (str[i] == '1');
  cout << satu << endl;
  {
    fflush(stdin);
    getchar();
  };
  return 0;
}
