title: Return a list of rotational equivalence pairs from a given string in scala
body: <p>Input String </p>
  
  <blockquote>
    <p>["ac","bd","ce", "aaa","xyz","bbb","abc","kt","zb"]</p>
  </blockquote>
  
  <p>I want the below output:</p>
  
  <blockquote>
    <p>[List("ac","bd","ce","zb"),List("aaa","bbb"),List("abc","xyz"),List("kt")]</p>
  </blockquote>
  
  <p>The logic here is I need to group similar elements into Lists.</p>
  
  <p>The pattern in the first list is, I have one letter skipped.</p>
  
  <p>The pattern in the second list is, I have one letter repeating thrice.</p>
  
  <p>The pattern in the third list is, I have 3 consecutive letters.</p>
  
  <p>After grouping all of this, I have one element which does not fall into any of the above patterns hence adding it to a seperate list.</p>
  
  <p>I am not sure of the algorithm/solution in scala. Any help is appreciated. TIA.</p>