#include <bits/stdc++.h>
char arr[1000005];
int main() {
  arr[0] = arr[1] = '0';
  scanf("%s", arr + 2);
  int len = strlen(arr), ans = 0;
  for (int i = len - 1; i >= 0; --i)
    if (arr[i] == '1') ++ans;
  for (int i = len - 1; i > 0;) {
    if (arr[i] == '1' && arr[i] == arr[i - 1]) {
      arr[i] = '2';
      while (arr[i - 1] == '1') --i, arr[i] = '0', --ans;
      arr[i - 1] = '1', ++ans;
    } else if (arr[i] == '2' && arr[i] == arr[i - 1]) {
      arr[i] = '1';
      while (arr[i - 1] == '2') --i, arr[i] = '0', --ans;
      arr[i - 1] = '2', ++ans;
    } else
      --i;
  }
  printf("%d\n", ans);
}
