Solution to the String Permutations CodeEval's challenge.