#include using namespace std; typedef long long ll; typedef pair pii; int b; ll goal; int solve(ll state, int minstep, int used = 0) { if (used > 5) return 6; if (state == goal) return used; int res = 6; for (int i=minstep; i < b; i++) { res = min(res, solve(state | (state >> i), i, used+1)); } return res; } int main () { ios::sync_with_stdio(false); string in; cin >> in; if (in[0] == '0') { cout << -1 << endl; return 0; } b = in.size(); goal = (1ll << b) - 1; ll start = 0; for (int i=0; i