problem 9.4 compute all permutations of a string