#include #include #include using namespace std; #define DIM 1005 char sir[DIM]; int V[DIM]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); #endif // ONLINE_JUDGE cin >> sir; int lg = strlen(sir); for(int i = 0; i < lg; i += 8) { int nr = 0; for(int j = i; j < i + 8; ++j) { nr = (nr << 1) + sir[j] - '0'; } V[++V[0]] = nr; } int cars = 0; for(int i = 1; i <= V[0]; ++i) { if(V[i] > (1 << 7)) { if(cars > 0) { cout << "No\n"; return 0; } int k = ((V[i] ^ (V[i] - 1)) & V[i]); while(k > 1) { ++cars; k >>= 1; } } else { if(cars > 0) { --cars; } else { cout << "No\n"; return 0; } } } if(cars == 0) cout << "Yes\n"; else cout << "No\n"; return 0; }