#include "bits/stdc++.h" using namespace std; void solve() { string s; cin >> s; int n = s.size(); int dp[] = {0, 10000000}; for (int i = n - 1; i >= 0; i--) { int nx[2] = {}; if (s[i] == '0') { nx[0] = min(dp[0], dp[1] + 1); nx[1] = min(dp[1] + 1, dp[0] + 2); } else { nx[0] = dp[0] + 1; nx[1] = min(dp[1], dp[0] + 1); } swap(dp, nx); } cout << min(dp[0], dp[1] + 1) << endl; } int main() { solve(); return 0; }