Many years have passed after Simba’s death. The jungle has a new lion cub born just a few hours ago. Everyone came to see their future king. What’s his name? Well, that is the problem. They want to give him a name, that was in each of their last N king’s name as a unique substring.
The substring should be unique because repeating substrings are not prestigious enough to be the name of a king! And it iscommon between N kings’ names, because that’s how the jungle pay their tribute to kings, those who have gone in the history and those yet to come. Also, they want their current king’s name to be as long as possible. Otherwise they will fall short of names in the future. Can you help them?
You are given N strings consisting of only lowercase English letters. Find the length of the largest common unique substring from them.
A substring is unique if it occurs only once in a string. A common unique substring is a kind of substring which occurs exactly once in each string.
The first line of the input contains one integer N. The next N lines contain N strings.
2 <= N <=10
2 <= length of each string <= 105
Print the length of the substring as described in the problem statement.
2 aaaadbbdaaaa aaaaaaarbbraaaaaaaaa