C# code as below:
class Program
{
static void Main(string[] args)
{
Method("123");
Console.ReadKey();
}
static void Method(string str,string str2="")
{
if (str == null)
return;
if (str == string.Empty)
Console.WriteLine(str2);
for (int i = 0; i < str.Length; i++)
{
Method(str.Remove(i, 1), str2+str[i].ToString());
}
}
}
output:
<!--StartFragment -->