#include #include using namespace std; int main() { const int NUM_OF_DAYS = 14; int d; cin >> d; char calendar[NUM_OF_DAYS + 1]; int index = 0; char buf[8]; for (int i = 0; i < 2; i++) { cin >> buf; for (int j = 0; j < 7; j++) { calendar[index++] = buf[j]; } } calendar[NUM_OF_DAYS] = '\0'; int maxDays = 0; index = 0; while (index < NUM_OF_DAYS) { while (calendar[index] == 'x') index++; if (calendar[index] == '\0') break; int startIndex = index; while (calendar[index] == 'o') index++; index += d; if (index < NUM_OF_DAYS) { while (calendar[index] == 'o') index++; } maxDays = max(maxDays, index - startIndex); } cout << maxDays << endl; system("pause"); return 0; }