title: What's the best way to split a list of strings to match first and last letters?
body: <p>I have a long list of words in C#, and I want to find all the words within that list that have the same first and last letters and that have a length of between, say, 5 and 7 characters. For example, the list might have:</p>
  
  <blockquote>
    <p>"wasted was washed washing was washes watched watches wilts with wastes wits washings"</p>
  </blockquote>
  
  <p>It would return</p>
  
  <blockquote>
    <p>Length: 5-7, First letter: w, Last letter: d, "wasted, washed, watched"
    Length: 5-7, First letter: w, Last letter: s, "washes, watches, wilts, wastes"</p>
  </blockquote>
  
  <p>Then I might change the specification for a length of 3-4 characters which would return</p>
  
  <blockquote>
    <p>Length: 3-4, First letter: w, Last letter: s, "was, wits"</p>
  </blockquote>
  
  <p>I found this method of splitting which is really fast, made each item unique, used the length and gave an excellent start:
  <a href="https://stackoverflow.com/questions/11378338/spliting-string-into-words-length-based-lists-c-sharp">Spliting string into words length-based lists c#</a></p>
  
  <p>Is there a way to modify/use that to take account of first and last letters?</p>
  
  <p>EDIT</p>
  
  <p>I originally asked about the 'fastest' way because I usually solve problems like this with lots of string arrays (which are slow and involve a lot of code). LINQ and lookups are new to me, but I can see that the ILookup used in the solution I linked to is amazing in its simplicity and is very fast. I don't actually need the minimum processor time. Any approach that avoids me creating separate arrays for this information would be fantastic.</p>