MGLAR10 - Growing Strings
Each test case is given using several lines. The ﬁrst line contains an integer N representing the number of strings in the set (1 ≤ N ≤ 10^4). Each of the following N lines contains a diﬀerent non-empty string of at most 1000 lowercase letters of the English alphabet. Within each test case, the sum of the lengths of all strings is at most 10^6.
The last test case is followed by a line containing one zero.
For each test case output a single line with a single integer representing the size of the largest sequence of photos that can be produced.
6 plant ant cant decant deca an 2 supercalifragilisticexpialidocious rag 0
Pablo Ariel Heiber:
I'm the author of the original problem and both my official solutions get TLE. I guess there is a problem with the cases and/or the TL.
--Last edit: 2016-10-24 21:45:18
WAAAALast edit: 2012-03-16 06:51:07