#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair
int main(){
ios_base::sync_with_stdio(0);
string x;
cin>>x;
x+="@";
int s=0;
for(int i=1;i<x.size()-1;i++){
if(x[i-1]=='1'&&x[i+1]=='1')x[i]='!';
}
for(int i=0;i<x.size();i++){
if(x[i]=='1'||x[i]=='!')s++;
}
cout<<s<<endl;
return 0;
}