title: Algorithm to generate all possible letter combinations of given string down to 2 letters
body: <p>Algorithm to generate all possible letter combinations of given string down to 2 letters</p>
  
  <p>Trying to create an Anagram solver in AS3, such as this one found here:</p>
  
  <p><a href="http://homepage.ntlworld.com/adam.bozon/anagramsolver.htm" rel="noreferrer">http://homepage.ntlworld.com/adam.bozon/anagramsolver.htm</a></p>
  
  <p>I'm having a problem wrapping my brain around generating all possible letter combinations for the various lengths of strings. If I was only generating permutations for a  fixed length, it wouldn't be such a problem for me... but I'm looking to reduce the length of the string and obtain all the possible permutations from the original set of letters for a string with a  max length smaller than the original string. For example, say I want a string length of 2, yet I have a 3 letter string of “abc”, the output would be: ab ac ba bc ca cb.</p>
  
  <p>Ideally the algorithm would produce a complete list of possible combinations starting with the original string length, down to the smallest string length of 2. I have a feeling there is probably a small recursive algorithm to do this, but can't wrap my brain around it. I'm working in AS3.</p>
  
  <p>Thanks!</p>