package no204a; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int d = sc.nextInt(); char[] c = new char[100]; for(int i=0;i<2;i++) { char[] s = sc.next().toCharArray(); for(int j=0;j<7;j++) { c[20+i*7+j] = s[j]; } } int max = 0; for(int k=0;k<100;k++) { int now = 0; int yukyuu = 0; for(int i=0;i<100;i++) { if (i == k) { yukyuu = d; } if (c[i] == 'o') { now++; max = Math.max(max, now); yukyuu = 0; }else if(yukyuu > 0){ now++; max = Math.max(max, now); yukyuu--; }else{ now = 0; } } } System.out.println(max); } }