#include #include #include int main() { int holiday; std::string weeks, s; std::cin >> holiday; std::cin >> s; weeks = s; std::cin >> s; weeks += s; int max = 0; int i = 0; while (weeks[i] == 'o') { max++; i++; } max += holiday; for (i = 0; i < weeks.length(); i++) { int count = 0, holi_num = 0; bool flag = false; for (int j = i; j < weeks.length(); j++) { while (weeks[j] == 'x') { count++; holi_num++; j++; if (count == holiday || j != weeks.length() - 1 || weeks[j] == 'o') { flag = true; break; } } if (flag)break; holi_num++; } holi_num += holiday - count; max = std::max(max, holi_num); } std::cout << max << std::endl; return 0; }