#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; for (int j = i; j < weeks.length(); j++) { if (flag && weeks[j] == 'x')break; while (weeks[j] == 'x') { count++; if (count == holiday || j >= weeks.length() || weeks[j + 1] == 'o') { flag = true; break; } holi_num++; j++; } holi_num++; } if(!flag)holi_num += holiday - count; max = std::max(max, holi_num); } std::cout << max << std::endl; return 0; }