title: How to type sets for a given string
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/13765699/how-can-i-obtain-all-the-possible-combination-of-a-subset">How can I obtain all the possible combination of a subset?</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to type the sets for a given string for example
  "123" will give {1}{2}{3}{13}{23}{12}{123}{}
  but my code gives me 1 1 
  Please can Anyone tell me why and please help me to fix it 
  Thanks all</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq; 
  using System.Text;
  
  namespace TestAAD
  {
  class Program
  {
      static List&lt;string&gt; sets = new List&lt;string&gt;();
      static int len = 0;
  
      private static void Generte_Sets(string str, int i)
      {
  
          sets.Add(str[i].ToString());
  
          if (i &lt; len)
              Generte_Sets(str, i + 1);
          else
          {
              for (int j = 0; j &lt; sets.Count; j++)
                  Console.Write(sets[j]);
              Console.WriteLine();
          }
  
          sets.Remove(str[i].ToString());  
          if (i &lt; len)
              Generte_Sets(str, i + 1);
          else
          {
              for (int j = 0; j &lt; sets.Count; j++)
                  Console.Write(sets[j]);
              Console.WriteLine();
          }
      }
  
      static void Main(string[] args)
      {
          string set = "123";
  
          Generte_Sets(set, 0);
          len = set.Length;
          for (int i = 0; i &lt; sets.Count; i++)
          {
              Console.WriteLine(sets[i]);
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Please I need help to type the sets 
  I need quick help 
  thanks All</p>