permutations c++ solution