#include #define FOR(n, a, b) for(size_t n = (a); n < (b); ++n) #define ALL(x) x.begin(), x.end() #define pb push_back #define st first #define nd second using namespace std; typedef long long ll; typedef pair pint; typedef vector vi; typedef vector vvi; typedef vector vii; unsigned long long n; string s; string move_str(string s, int k) { string s1 = s; FOR(i, 0, s.size()-k) { s1[i+k] = (s[i] == '1' || s[i+k] == '1') ? '1' : '0'; } return s1; } int first_zero(string s) { FOR(i, 1, s.size()) { if(s[i] == '0') return i; } return -1; } int check(string s) { if(first_zero(s) == -1) return 0; return check(move_str(s, first_zero(s))) + 1; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> s; cout << check(s) << '\n'; return 0; }