package no204; 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[14]; for(int i=0;i<2;i++) { char[] s = sc.next().toCharArray(); for(int j=0;j<7;j++) { c[i*7+j] = s[j]; } } int max = 0; for(int k=0;k<14;k++) { int now = 0; int yukyuu = 0; for(int i=0;i<14;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); } }