A backup system inspects a set of filenames (each a string of lowercase English letters) to detect a shared trailing extension pattern. Compute the length of the longest common suffix of all n names: the largest L such that the last L characters of every name are identical. If they share no trailing character, the answer is 0.
Input format
Line 1: an integer n, the number of names.
Next n lines: one name per line, each a non-empty string of lowercase English letters.
Output format
A single integer: the length of the longest common suffix of all n names.
Constraints
- 1 <= n <= 1000
- 1 <= length of each name <= 1000
- Each name consists only of lowercase English letters (
a-z).