#include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=1<<18; const ll INF=1LL<<55; int main(){ string S;cin>>S; stack<char> ST; for(int i=0;i<S.size();i++){ ST.push(S[i]); } int ans=0; while(!ST.empty()){ int cnt=0; while(!ST.empty()&&ST.top()=='1'){ ST.pop(); cnt++; } if(cnt==0){ if(!ST.empty()) ST.pop(); }else if(cnt==1){ ans++; if(!ST.empty()) ST.pop(); }else{ ans++; if(!ST.empty()) ST.pop(); ST.push('1'); } } cout<<ans<<endl; }