// oteage-no-mai #include #include #include #include //#include using namespace std; using i32 = int32_t; using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; #define rep(i,n) for(int i=0; i<(n); i++) //using m32 = atcoder::static_modint<998'244'353>; int msb_idx(u64 x){ return 63 - __builtin_clzll(x); } int C_size_to_N(int C_size){ int n = 0; int c_size_left = C_size; while(c_size_left > 0){ n++; c_size_left -= msb_idx(n) + 1; } if(c_size_left != 0) return -1; return n; } string to_binstr(u64 n){ string res; while(n){ res.push_back('0' + (n&1)); n>>=1; } reverse(res.begin(), res.end()); return res; } u64 from_binstr(const string& s){ u64 res = 0; for(char c : s) res = res * 2 + (c - '0'); return res; } string C; int N; vector code; vector> candid; vector> length_pos_code; int main(){ cin >> C; N = C_size_to_N(C.size()); //cerr << "N = " << N << endl; code.resize(N); for(int i=1; i<=N; i++) code[i-1] = to_binstr(i); length_pos_code.assign(code.back().size()+1, vector(C.size(), -1)); candid.resize(N); for(int l=1; l<=code.back().size(); l++){ for(int p=0; p+l<=C.size(); p++){ if(C[p] == '0') continue; if(C.size() != p+l) if(C[p+l] == '0') continue; int v = from_binstr(C.substr(p,l)); if(v > N) continue; length_pos_code[l][p] = v-1; candid[v-1].insert(p); } } vector list_det; for(int v=0; v(0,p-nxl+1); nxp<=min(C.size()-1,p+l-1); nxp++){ int nxv = length_pos_code[nxl][nxp]; if(nxv == -1) continue; if(nxl == l && nxp == p) continue; candid[nxv].erase(nxp); length_pos_code[nxl][nxp] = -1; if(candid[nxv].size() == 1) list_det.push_back(nxv); } } } //for(int i=0; i> ans; for(int i=0; i