#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; const ll mod = 1000000007; const ll INF = mod * mod; typedef pair P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef pair LP; typedef vector vec; typedef long double ld; typedef pair LDP; const ld eps = 1e-5; const ld pi = acos(-1.0); string s; void solve() { cin >> s; int len = s.length(); reverse(s.begin(), s.end()); int dp[2] = { 0,mod }; int cop[2] = { mod,mod }; rep(i, len) { rep(j, 2)cop[j] = mod; if (s[i] == '0') { cop[0] = min(cop[0], dp[0]); cop[0] = min(cop[0], dp[1] + 1); cop[1] = min(cop[1], dp[1] + 1); } else { cop[0] = min(cop[0], dp[0] + 1); cop[1] = min(cop[1], dp[0] + 1); cop[1] = min(cop[1], dp[1]); } rep(j, 2)dp[j] = cop[j]; } cout << min(dp[0], dp[1]+1) << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0); //cout << fixed << setprecision(50); //init(); solve(); //cout << "finish" << endl; //top return 0; }