Recursive Algorithm For Array Permutations Of A String