#include #include #include using namespace std; int cate,n,ras; char s[1004]; int main() { //freopen("input","r",stdin); // freopen("output","w",stdout); gets(s+1); n=strlen(s+1); ras=1; for(int i=1;i<=n;i++) { if(s[i]=='1') { if(cate>0){ras=0;break;} for(int j=2;j<=8;j++) { i++; if(s[i]=='0')cate++; else cate=0; } } else if(s[i]=='0') { cate--; i+=7; } } if(ras==0)printf("NO"); else printf("YES"); return 0; }