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
1≤N≤100
1≤�≤1001≤D≤100
�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 |