#include #define rep(i,n) for(int i=0;i ; const int INF = 1e9; const int MOD = 1000000007; int main(){ string s; cin >> s; int n = s.size(); vector> dp(n+1,vector(2,INF)); dp[0][0] = 0; for(int i=1;i<=n;i++){ int sd = s[n-i] - '0'; //cout << sd << endl; if(sd == 0){ dp[i][0] = min(dp[i-1][0],dp[i-1][1] + 1); dp[i][1] = dp[i-1][1] + 1; }else{ dp[i][0] = dp[i-1][0] + 1; dp[i][1] = min(dp[i-1][0] + 1,dp[i-1][1]); } } dp[n][1] ++; cout << min(dp[n][0],dp[n][1]) << endl; /* rep(i,n){ rep(j,2) cout << dp[i][j] << " "; cout << endl; }*/ return 0; }