#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  int i = 0;
  int N = s.size();
  int cnt = 0;
  for (int i = 0; i < N; i++)
    if (s[i] == '0') cnt++;
  int ans = 0;
  int tmp = 0;
  while (i < N) {
    bool flag = false;
    int num = 0;
    while (i < N && s[i] == '0') i++, num++;
    if (num == 1 && tmp > 1) {
      flag = true;
    }
    if (flag == false) tmp = 0;
    if (i >= N) break;
    while (i < N && s[i] == '1') {
      tmp++;
      i++;
    }
    if (flag)
      ans++;
    else if (tmp == 1)
      ans += 1;
    else
      ans += 2;
  }
  cout << ans << endl;
  return 0;
}
