Problem: Roman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string multiplication. According to Denis, the result of multiplication (product) of strings of length and is a string , where denotes the -th symbol of the string , and "+" denotes string concatenation. For example, the product of strings "abc" and "de" is a string "deadebdecde", while the product of the strings "ab" and "z" is a string "zazbz". Note, that unlike the numbers multiplication, the product of strings and is not necessarily equal to product of and .
Roman was jealous of Denis, since he invented such a cool operation, and hence decided to invent something string-related too. Since Roman is beauty-lover, he decided to define the beauty of the string as the length of the longest substring, consisting of only one letter. For example, the beauty of the string "xayyaaabca" is equal to , since there is a substring "aaa", while the beauty of the string "qwerqwer" is equal to , since all neighboring symbols in it are different.
In order to entertain Roman, Denis wrote down strings on the paper and asked him to calculate the beauty of the string , where denotes a multiplication of strings and . Roman hasn't fully realized how Denis's multiplication works, so he asked you for a help. Denis knows, that Roman is very impressionable, he guarantees, that the beauty of the resulting string is at most .
Input Format: The first line contains a single integer () — the number of strings, wroted by Denis.
Next lines contain non-empty strings , consisting of lowercase english letters.
It's guaranteed, that the total length of the strings is at most , and that's the beauty of the resulting product is at most .
Output Format: Print exactly one integer — the beauty of the product of the strings.
Note: In the first example, the product of strings is equal to "abaaaba".
In the second example, the product of strings is equal to "abanana".