UVa 10098 - Generating Fast

10098 - Generating Fast, Sorted Permutation

 * http://acm.uva.es/p/v100/10098.html

Summary
Generate all unique permutations in sorted order.

Explanation
Use the C++ stl permutation and you should be able to pass the tests.

Input
3 ab abc bca

Output
ab ba

abc acb bac bca cab cba

abc acb bac bca cab cba