#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 = holiday; //ゴールデンウィークの前から有給をとる場合 for (int i = 0; weeks[i] == 'o'; i++) { max++; } for (int i = 0; i < weeks.length(); i++) { int count = 0, holi_num = 0; bool flag = false; int j = i; while (j < weeks.length() && weeks[j] == 'o') { holi_num++; j++; } while (j < weeks.length() && weeks[j] == 'x' && count != holiday) { count++; holi_num++; j++; } while (j < weeks.length() && weeks[j] == 'o') { flag = true; holi_num++; j++; } if (!flag)holi_num += holiday - count; max = std::max(max, holi_num); } std::cout << max << std::endl; return 0; }