|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||2||2||2||100.000%|
Stringld (left delete) is a function that gets a string and deletes its leftmost character (for instance Stringld(“acm”) returns “cm”).
You are given a list of distinct words, and at each step, we apply stringld on every word in the list. Write a program that determines the number of steps that can be applied until at least one of the conditions become true:
For example, having the list of words aab, abac, and caac, applying the function on the input for the first time results in ab, bac, and aac. For the second time, we get b, ac, and ac. Since in the second step, we have two ac strings, the condition 2 is true, and the output of your program should be 1. Note that we do not count the last step that has resulted in duplicate string. More examples are found in the sample input and output section.
There are multiple test cases in the input. The first line of each test case is n (1 n 100), the number of words. Each of the next n lines contains a string of at most 100 lower case characters. The input terminates with a line containing 0.
For each test case, write a single line containing the maximum number of stringld we can call.
4 aaba aaca baabcd dcba 3 aaa bbbb ccccc 0