#include #include #include int main() { int d, max = 0; std::string s, s2; std::cin >> d >> s >> s2; s += s2; // 前と後ろに平日を追加する for (int i = 0; i < 14; i++) { s.insert(0, "x"); s += "x"; } for (int i = 0; i < s.length() - d + 1; i++) { // i日目から有給休暇を取る int remain_holiday = d, j = i; std::string day = s; while (remain_holiday != 0 && j < s.length()) { if (day[j] == 'x') { day[j] = 'o'; remain_holiday--; } j++; } //std::cout << day << std::endl; int holiday = 0; for (int j = 0; j < s.length() - i + 1; j++) { if(day[j] == 'o'){ holiday++; } else { max = std::max(max, holiday); holiday = 0; } } max = std::max(max, holiday); } std::cout << max << std::endl; return 0; }