/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.17 17:19:39 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { string s;cin >> s; bool c = false; int cnt = 0; for (int i = s.size()-1; i >= 0; i--) { if (c && s[i] == '1') { s[i] = '0'; } else if (c) { c = false; s[i] = '1'; i++; } else if (s[i] == '1' && i > 0 && s[i-1] == '1') { c = true; s[i] = '0'; cnt++; } } for (int i = 0; i < s.size(); i++) { if (s[i] == '1') cnt++; } if (s[0] == '0') cnt++; cout << cnt << endl; return 0; }