我要试着用样本来解释。
资料来源:

something

变化:
s.o.m.e.t.h.i.n.g
so.m.e.t.h.i.n.g
som.e.t.h.i.n.g
som.et.hi.n.g.
.
.
.

我需要一个算法来在C或Delphi中创建上面的最大变量
有人知道吗?

最佳答案

using System;
using System.Collections.Generic;

namespace ConsoleApplication {
    public static class ConsoleApp {
        public static void Main() {
            foreach (var permutation in Permutations("some"))
                Console.WriteLine(permutation);

            Console.ReadLine();
        }

        public static IEnumerable<String> Permutations(String value) {
            if (value.Length == 1) {
                yield return value;
            } else {
                var current = value.Substring(0, 1);

                foreach (var permutation in Permutations(value.Substring(1)))
                    yield return current + "." + permutation;

                foreach (var permutation in Permutations(value.Substring(1)))
                    yield return current + permutation;
            }
        }
    }
}

10-08 14:01