here's a couple of neat little snippets i had lying around that relate to this :P

Code:
alias brute {
  var %a
  while %a < $str(z,$1) {
    %a = $regsubex(%a,([^z]?)(z*$),$iif(\1,$chr($calc(1+$asc(\1))),a) $+ $str(a,$len(\2)))
    echo -a %a
  }
}


/brute <N> echos all possible combinations of a-z for string lengths of up to and including N. so /brute 2 echos a, b, c, ..., x, y, z, aa, ab, ..., zy, zz

Code:
alias permute {
  var %x 0,%y
  while ($regsub($1,(.{ $+ %x $+ })(.),\1,%y)) scon -r inc $(%x |,) $iif(? iswm $1,echo -a,permute %y) $2 $+ $regml(2)
}


/permute <string> echos all permutations of the string, doesnt take duplicate characters into account though. so /permute abc echos:

abc
acb
bac
bca
cab
cba

they're not extremely practical, especially for what you want, but they're fun to play around with :>


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde