Stringld (left delete) takes a string and removes its leftmost character. For example, Stringld("acm") returns "cm".
You are given a list of distinct words. In one step you apply Stringld once to every word in the list. Write a program that finds how many steps you can apply before at least one of the two conditions below becomes true.
For example, take the list aab, abac, caac. Applying the function once gives ab, bac, aac. Applying it again gives b, ac, ac, and because ac appears twice, condition 2 is true. The answer is 1. The step that made the condition true is not counted.
The input holds several test cases. The first line of each test case has the number of words n (1≤n≤100). Each of the next n lines has one word of at most 100 lowercase letters. Inside one test case all words are different. The input ends with a line holding a single 0.
For each test case, print on one line the largest number of times Stringld can be called.