#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int M = 1000010;
const int mod = 1000000007;
const double eps = 1e-8;
const double Pi = 2 * acos(0.0);
char s[M];
int main() {
  ios::sync_with_stdio(0);
  cin >> s;
  int tmp = 0, zero = 2, con = 0, single = 0;
  for (int i = 0; s[i];) {
    if (s[i] == '1') {
      con = 0;
      while (s[i + con] == '1') con++;
      if (con == 1) {
        tmp++;
        if (zero > 1) single = 1;
      } else if (zero == 1) {
        tmp++;
        if (single) tmp++;
        single = 0;
      } else {
        tmp += 2;
        single = 0;
      }
      i += con;
    } else {
      zero = 0;
      while (s[i + zero] == '0') zero++;
      i += zero;
    }
  }
  cout << tmp << endl;
  return 0;
}
