#include using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef long double ld; typedef pair P; int main() { string s; cin >> s; s = '0' + s; reverse(s.begin(), s.end()); int i = 0; int n = s.size(); int res = 0; for (int i = 0; i < n; i++) { if (s[i] == '1') { if (s[i + 1] == '0') { s[i] = '0'; res++; } else { while (s[i] == '1') i++; s[i] = '1'; i--; res++; } } } cout << res << endl; return 0; }