Code for problem "Next Permutation".