#define _USE_MATH_DEFINES #include using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int ans = 0, seq = 0; s.push_back('0'); for (char c : s) { if (c == '1') { seq++; } else { if (seq > 2) ans += 2; else if (seq) ans += 1; seq = 0; } } cout << ans << endl; return 0; }