using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static List<string> hehe = new List<string>();
static void Main(string[] args)
{
string s = "abcde";
for (int i = 0; i < s.Length; i++)
{
play(s[i].ToString(),s.Remove(i,1));
}
foreach (string m in hehe)
{
Console.Write(m + " ");
}
Console.Read();
}
static void play(string first, string last)
{
if (last.Length == 1)
{
hehe.Add(first + last);
}
for (int i = 0; i < last.Length; i++)
{
play(first + last[i], last.Remove(i, 1));
}
}
}
}
给定你一个字符串,把字符串中每个字符按不同位置打印
最新推荐文章于 2022-07-13 16:36:10 发布