#include<iostream>
#include<vector>
#include<string>
using namespace std;
typedef vector<string> vectorString;
vectorString permu(string str)
{
if(str.length()==0)
{
vectorString vs;
vs.push_back("");
return vs;
}else if(str.length()==1)
{
vectorString vs;
vs.push_back(str);
return vs;
}
vectorString vs;
string ch=str.substr(0,1);
vectorString vsTmp= permu(str.substr(1));
for(int i=0;i<vsTmp.size();i++)
{
string strTmp=vsTmp[i];
for(int j=0;j<=strTmp.length();j++)
{
string strTmp2=strTmp;
strTmp2.insert(j,ch);
//cout<<strTmp2<<endl;
vs.push_back(strTmp2);
}
}
return vs;
}
int main()
{
string str="abcdefg";
vectorString vs=permu(str);
cout<<vs.size()<<endl;
for(int i=0;i<vs.size();i++)
{
cout<<vs[i]<<endl;
}
cout << endl<<"Hello world!" << endl;
return 0;
}