//101 <=> 010
//10101 <=> 01010 这种序列满足此条件
//10101010
//01010100
//00101000
//00010000
//连续个1
//1010111
//0101011
//0010111
//
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 1e6+10;
string a;
int n;
int w[N];
int ans,last;
int main(){
cin>>a;
n=a.size();
for(int i=0,j=1;i<n;i++,j++){
w[j]=a[i]-'0';
}
// w[n+1]=-1;/
//随便写的,认为只能有一个长度为3的去更新,但仔细读题,发现可能有长度为5,7这样的
// for(int i=1;i<n-1;i++){
// if(w[i]=='0'&&w[i-1]=='1'&&w[i+1]=='1'){
// w[i]='1';
// w[i-1]=w[i+1]='0';
// }
// }
// for(int i=0;i<n;i++){
// if(w[i]=='1'){
// ans++;
// }
// }
for(int i=1,j=2;i<=n;i++,j++){
if(w[i]==w[j]&&w[i]==1){
while(j<=n){
if(w[j]==1){
ans++;
i++,j++;
}else{
break;
}
}
}
if(w[i]&&(!w[j])){
//01交替
ans++;
while(j<=n){
if(w[i]==w[j]){
break;
}
i++,j++;
}
}
// i++,j++;
}
// cout<<last;
// if(w[n])ans++;
cout<<ans;
return 0;
}