#include<bits/stdc++.h>
using namespace std;

int main()
{
    string s; cin>>s;
    s='0'+s;
    reverse(s.begin(),s.end());
    int N=s.size();
    

    int ans=0;
    for(int i=0;i<N;){
        while(i<N and s[i]=='0') i++;
        int cnt=0;
        while(i<N and s[i]=='1') i++,cnt++;
        if(cnt==1){
            ans+=1;
            if(i==N-1) break;
        }else{
            ans+=1;
            s[i]='1';
        }
    }
    cout<<ans<<endl;
    return 0;
}