title: Find the length of longest chain formed using given words in String
body: <p>Okk As programmer we love get involved in logic building but that is not the case some time we become blank over some type of puzzle as below mentioned. Let me declare that this is not any kind of homework or job stuff it simply a logic and performance practice puzzle.Okk the puzzle of given an String<code></code>s` with comma separated words like </p>
  
  <pre><code>String S= peas,sugar,rice,soup
  </code></pre>
  
  <p>Now crux is to find out length of longest chain of the words like last character of word should be the first character of next word and so on to create a longest possible chain and finally to calculate the length of that chain.</p>
  
  <p>Now I had tried to figure out some sort of solution like</p>
  
  <ol>
  <li>split the <code>string</code> with comma</li>
  <li>add them in <code>list</code> </li>
  <li>sort that <code>list</code>
  etc</li>
  </ol>
  
  <p>but now how to develop further logic As I m little poor over logic development,Help is appreciated and if above half logic is not proper as it should be than what must the simple sort and perfect way to get the length of the longest chain of words.</p>
  
  <p>Summary<br>
  <strong>input</strong>: <code>String S= peas,sugar,rice,soup</code>.<br>
  <strong>output</strong>: 4 length of words (peas->sugar->rice->soup) or (soup->peas->sugar->rice) etc</p>