#include #include #include #include using namespace std; int c(string w) { int d = 0, ret = 0; for(int i = 0; i < 42; i++) { if(w[i] == 'o') d++; else d = 0; ret = max(ret, d); } return ret; } int main() { int d; string w, w1, w2; cin >> d >> w1 >> w2; w = "xxxxxxxxxxxxxx" + w1 + w2 + "xxxxxxxxxxxxxx"; int ans = 0; for(int i = 0; i <= 28; i++) { string ww = w; bool flag = true; for(int j = 0; j < d; j++) { if(ww[i + j] == 'o') { flag = false; break; } ww[i + j] = 'o'; } if(flag) { ans = max(ans, c(ww)); } } cout << ans << endl; }