#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0, n = s.length(), j;
  for (int i = 0; i < n;) {
    if (s[i] == '1') {
      j = i + 1;
      while (j < n && s[j] == '1') {
        j++;
      }
      if (j - i > 1)
        ans += 2;
      else
        ans++;
      if (j + 1 < n && s[j + 1] == '1' && j - i > 1) {
        s[j] = '1';
        ans--;
      }
      i = j;
    } else
      i++;
  }
  cout << ans << endl;
  return 0;
}
