void swap(char& a, char& b){
char temp = a;
a = b;
b = temp;
}
void perm(vector<char>& vec, int start, int end, vector<vector<char>>& res){
if(start == end){
vector<char> re(end, 0);
for(int i = 0; i < end; i++){
re[i] = vec[i];
}
res.emplace_back(re);
return;
}
for( int i = start; i < end; i++){
swap(vec[start], vec[i]);
perm(vec, start+1, end, res);
swap(vec[i], vec[start]);
}
}
int test_perm(){
vector<char> vec = {'a', 'b', 'c', 'd', 'e'};
vector<vector<char>> res;
perm(vec, 0, (int)vec.size(), res);
return 0;
}