#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; reverse(s.begin(), s.end()); vector dp(2, 1 << 30); dp[0] = 0; for (char c : s) { vector nxt(2); int x = c - '0'; if (x == 0) { nxt[0] = min(dp[0], dp[1] + 1); nxt[1] = dp[1] + 1; } if (x == 1) { nxt[0] = dp[0] + 1; nxt[1] = min(dp[0] + 1, dp[1]); } swap(dp, nxt); } cout << min(dp[0], dp[1] + 1) << '\n'; return 0; }