permutations of a string problem implemented and tested