#include #include using namespace std; int main() { string s; getline(cin, s); bool k = 1; int c, x = 0; int nrs = 0, cnr = 0; while(x < s.size()-1 && k) { c = s[x]-'0'; if(c){ if(cnr) k = 0; else for(int i = 1; i < 8; ++i){ c = s[x+i]-'0'; if(!c) ++nrs; else nrs = 0; } cnr = nrs; } else if(!cnr) k = 0; else { --cnr; } x += 8; } if(k && !cnr) cout << "Yes"; else cout << "No"; return 0; }