import std.algorithm; import std.array; import std.conv; import std.math; import std.stdio; import std.string; import std.range; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.map!(to!int).array; } int calc(int d, string s) { // 平日=0, 休日=1 int[] ss = s.map!(e => e == 'x' ? 0 : 1).array; auto as = 0.repeat().take(d).array; auto xs = as ~ ss ~ as; // 2 週間の前後を挟む int ans = 0; for (int i = 0; i < xs.length - d; i++) { // i 日目から連続で d 日休暇 auto ys = xs.dup; for (int j = i; j < i + d; j++) { // i 日目から d 日休暇 if (ys[j] == 1) // 休日はまたがない break; ys[j] = 1; } int holidays = 0; for (int j = 0; j < xs.length; j++) { if (ys[j] == 1) { holidays++; ans = max(ans, holidays); } else { holidays = 0; } } } return ans; } void main() { int d = readint(); auto s = readln.chomp; auto t = readln.chomp; writeln(calc(d, s ~ t)); }