#include <bits/stdc++.h>
using namespace std;
string s;
int a[int(1e6 + 5)], res;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) a[i] = int(s[i] - '0');
  for (int i = s.size() - 1; i + 1; i--) {
    if (a[i] == 2) {
      if (i) a[i - 1]++;
      res++;
    }
    if (a[i] == 0) res++;
    if (a[i] == 1) {
      if (i) {
        res += 2;
        a[i - 1]++;
      }
    }
  }
  cout << res;
  return 0;
}
