using System; using System.Collections.Generic; using System.Linq; namespace No204_1{ public class Program{ public static void Main(string[] args){ var god = int.Parse(Console.ReadLine()); var days = string.Empty; days += "\0xxxxxxxxxxxxxx"; days += Console.ReadLine(); days += Console.ReadLine(); days += "xxxxxxxxxxxxxx\0"; var happyDays = new List{0}; var fuckingDays = new List{0}; var cntx = 0; var cnto = 0; foreach(var day in days){ if(day == 'x'){ cntx++; } else if(cntx != 0){ fuckingDays.Add(cntx); cntx = 0; } if(day == 'o'){ cnto++; } else if(cnto != 0){ happyDays.Add(cnto); cnto = 0; } } happyDays.Add(0); fuckingDays.Add(0); var max = 0; if(god != 0){ for(var i = 0; i < fuckingDays.Count; i++){ if(1<= fuckingDays[i] && fuckingDays[i] <= god) max = Math.Max(max, happyDays[i - 1] + happyDays[i] + fuckingDays[i]); if(fuckingDays[i] > god) max = Math.Max(max, Math.Max(happyDays[i - 1] + god, happyDays[i] + god)); } } else{ max = happyDays.Max(); } Console.WriteLine(max); } } }