#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long kol = 0;
  long i = s.size() - 1;
  while (i != 0) {
    if (s[i] == '0') {
      kol++;
      i--;
    } else {
      if (s[i] == '1') {
        kol++;
        s[i - 1]++;
        s[i] = '0';
      }
      if (s[i] == '2') {
        s[i] = '0';
        s[i - 1]++;
      }
    }
  }
  if (s[0] == '2') kol += 1;
  cout << kol;
}
