In this challenge, we suggest playing "Word chain" - a well-known game in which players come up with words that begin with the letter that the previous word ended with. Your task is to determine the maximum length of a chain that can be created from a list of words.
Your program should accept a path to a filename as its first argument. Each line of the file contains a list of words separated by comma.
For example:
soup,sugar,peas,rice ljhqi,nrtxgiu,jdtphez,wosqm cjz,tojiv,sgxf,awonm,fcv
Print out the length of the longest chain or print out "None" if there is no chain.
For example:
4 None 2
- The length of a list of words is in a range from 4 to 35.
- A word in a list is represented by a random lowercase ASCII string with the length from 3 to 7 letters.
- The words in a list do not repeat.