#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; void amin(int &a, const int &b) { a = min(a, b); } signed main() { cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int N = S.size(); int INF = (int)1 << 60; vector > dp(N + 1, vector(2, INF)); dp[0][0] = 0; for (int i = 0; i < N; i++) { if (S[N - i - 1] == '0') { amin(dp[i + 1][0], dp[i][0]); amin(dp[i + 1][1], dp[i][1] + 1); amin(dp[i + 1][0], dp[i][1] + 1); } else { amin(dp[i + 1][1], dp[i][0] + 1); amin(dp[i + 1][0], dp[i][0] + 1); amin(dp[i + 1][1], dp[i][1]); } } cout << min(dp[N][0], dp[N][1] + 1) << endl; }