You are given n strings consisting only of lowercase English letters. Write a program that finds the longest palindrome appearing as a substring in all n strings and prints its length.
A substring is a string cut out as one contiguous block of the original string.
A palindrome is a string that stays the same when reversed. For example, "ababa" is a palindrome, but "abcbd" is not.
Input
The first line contains a positive integer n, the number of strings. (1≤n≤50)
Each of the following n lines contains one string. Every string consists only of lowercase English letters, and no string is empty. The sum of the lengths of the n strings is at most 1,000,000.
Output
Print the answer on the first line. If no palindrome appears in all n strings, print 0.