시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 18 | 13 | 11 | 68.750% |
Friends play an interesting game with words. The goal of this game is arranging words in pairs.
Friends have $n$ words of the same length. They are choosing the largest number $k$ such that it is possible to divide the words into pairs so that words in each pair have common prefix of length at least $k$.
Find the maximum possible value of $k$.
The first line of input contains an even integer $n$ --- number of words ($1 \leq n \leq 2\cdot 10^5$).
The following $n$ lines contain words that the friends have. All words have same length. Total words length is less or equal to $2 \cdot 10^6$.
Output maximal possible value of $k$.
4 aabc aacc bbbb bbbd
2
2 a b
0