added function to compute permutations of a string.