compute all permutations of a string