python get permutations of string code example
Example 1: all permutations python
import itertools
print(list(itertools.permutations([1,2,3])))
Example 2: how to print all permutations of a string
void permutation(string s)
{
sort(s.begin(),s.end());
do{
cout << s << " ";
}
while(next_permutation(s.begin(),s.end()); // std::next_permutation
cout << endl;
}