title: Algorithm to generate all combinations of a specific size from a single set
body: <p>I am looking for solution in c# to generate combinations on given list of characters or word to perform dictionary attack on zip files. because we lost passwords file for those zip. Advantage is that we know possible words on it.  Dictionary should contain all the combos of words that I choose. And all characters/words are small case only.</p>
  
  <p>Example: Let say we have a set of chars: </p>
  
  <pre><code>Set A = {A,B,C}
  
  A,B,C   =3
  
  AA,AB,AC
  
  BA,BB,BC
  
  CA,CB,CC    =9
  
  
  AAA,AAB,AAC,ABA,ABB,ABC,ACA,ACB,ACC
  
  BAA,BAB,BAC,BBA,BBB,BBC,BCA,BCB,BCC
  
  CAA,CAB,CAC,CBA,CBB,CBC,CCA,CCB,CCA    = 27
  
  
  TOTAL POSIBLE COMBINATION 39
  </code></pre>
  
  <p>from the list of words a single word/character may repeat maximum of 4 times. If any such alogrithm/logic available please suggest.</p>