implemented get all permutations of a string algorithm