思路:dfs 暴搜
class Solution {
public:vector<string> permutation(string s) {vector<string> a;function<bool(char,int,int)> check=[&](char x,int st,int idx){if(st>idx) return false;for(int i=st;i<=idx;i++) if(s[i]==x) return true;return false;};function<void(int)> dfs = [&](int x){if(x==s.size()){a.push_back(s);return;}for(int i=x;i<s.size();i++){if(check(s[i],x,i-1)) continue;swap(s[i],s[x]);dfs(x+1);swap(s[i],s[x]);}};dfs(0);return a;}
};