#include using namespace std; const int LENMAX = 1000; int n; char s[LENMAX]; void citeste() { cin >> s; n = strlen(s); } void rezolva() { int expected_cars = 0; if (n % 8 != 0) { cout << "No\n"; return; } for (int i = 0; i < n; i += 8) { if (s[i] == '0') { if (expected_cars) { expected_cars--; continue; } else { cout << "No\n"; return; } } if (expected_cars) { cout << "No\n"; return; } for (int j = i + 7; j > i && s[j] == '0'; j--) expected_cars++; } if (expected_cars) cout << "No\n"; else cout << "Yes\n"; } int main() { citeste(); rezolva(); }