AdvancedRating 1600
Longest Word Chain
Word b follows word a if adding exactly one letter anywhere in a gives b. Print the length of the longest chain of words from the list.
Input
n, then n words separated by spaces.
Output
One integer.
Sample 1
Input
6 a b ba bca bda bdca
Output
4
Sample 2
Input
5 xbc pcxbcf xb cxbc pcxbc
Output
5
Output appears here