public static List<string> SinglePermutations(string s)
if (s.Length == 0) return new List<string>();
if (s.Length == 1) return new List<string>(new [] { s });
if (s.Length == 2) return new List<string>(new string[] { "" + s[0] + s[1], "" + s[1] + s[0] });
return SinglePermutations(s[1..])
.SelectMany(p => Enumerable.Range(0, p.Length).Select(i => p[0..i] + s[0] + p[i..])).Distinct().ToList();