next_permutation
1、 对字符串或者数组进行排序
sort(str.begin(), str.end());
2、利用while(next_permutation(str.begin(), str.end())进行全排列
vector<string> permutation(string S) {
vector<string> res;
sort(S.begin(), S.end());
res.push_back(S);
while (next_permutation(S.begin(), S.end())) {
res.push_back(S);
}
return res;
}