def holiday s s += 'x' tmp = ans = 0 15.times{|i| if s[i] == 'o' tmp += 1 else ans = [tmp, ans].max tmp = 0 end } return ans end def sol d, s if d == 0 return holiday(s) else ans = 0 14.times{|i| if s[i] == 'x' s[i] = 'o' ans = [sol(d - 1, s), ans].max s[i] = 'x' end } return ans end end d = gets.to_i s = STDIN.map(&:chomp).join('') p sol(d, s)