开始: 2023-09-17 08:00:00

0917日常周赛

结束: 2023-09-24 00:00:00
当前  2025-01-24 17:50:16  类型: IOI  状态: 已经结束 

P2. Vacation Together
描述

There are N people numbered 11 to N.
You are given their schedule for the following D days. The schedule for person i is represented by a string ��Si of length D. If the j-th character of ��Si is o, person i is free on the j-th day; if it is x, they are occupied that day.

From these D days, consider choosing some consecutive days when all the people are free.
How many days can be chosen at most? If no day can be chosen, report 00.


输入

The input is given from Standard Input in the following format:

N

s1

s2

...

sN

输出

Print the maximum number of days that can be chosen, or 0 if no day can be chosen.


样例

输入

3 5
xooox
oooxx
oooxo

输出

2

输入

3 3
oxo
oxo
oxo

输出

1

输入

3 3
oox
oxo
xoo

输出

0
提示
  • 1N100

  • 1≤�≤1001D100

  • N and D are integers.

  • ��Si is a string of length D consisting of o and x.


first

All the people are free on the second and third days, so we can choose them.
Choosing these two days will maximize the number of days among all possible choices.

second

Note that the chosen days must be consecutive. (All the people are free on the first and third days, so we can choose either of them, but not both.)

input4

1 7
ooooooo

output4

7

input5

5 15

5 15
oxooooooooooooo
oxooxooooooooox
oxoooooooooooox
oxxxooooooxooox
oxooooooooxooox

output5

5





提交

题目参数
时间限制 1 秒
内存限制 128 MB
提交