using System; using System.Collections.Generic; 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; for(var i = 0; i < fuckingDays.Count; i++){ if(fuckingDays[i] == god) max = Math.Max(max, happyDays[i - 1] + happyDays[i]); if(fuckingDays[i] > god) max = Math.Max(max, Math.Max(happyDays[i - 1], happyDays[i])); } Console.WriteLine(max + god); } } }