#include using namespace std; const int MAX_N = 1000 + 10; char s[MAX_N]; int n; vector things; int last(int x) { int ls = 7; while((x & (1 << ls)) == 0) --ls; return (7 - ls); } bool isLoco(int x) { return x & (1 << 0); } int main() { cin >> (s + 1); n = strlen(s + 1); if(n % 8 != 0) { cout << "No\n"; return 0; } for(int i = 1; i <= n; i += 8) { uint8_t now = 0; for(int j = 7; j >= 0; --j) { now |= (s[i + j] == '1') << j; } things.push_back(now); } int at = 0; while(at < things.size()) { if(isLoco(things[at])) { int must = last(things[at]); if(at + must >= things.size()) { cout << "No\n"; return 0; } for(int j = 1; j <= must; ++j) { if(isLoco(things[at + j])) { cout << "No\n"; return 0; } } at += must + 1; } else { at++; } } cout << "Yes\n"; return 0; }