自动提供唯一的排列组合: #include<algorithm> string str = "jiaghu" while(next_permutation(str.begin(),str.end())){ cout<<str<<endl; }