#include<iostream>
#include<cstring>
using namespace std;
void Permutation(char *p,const int k,const int m)
{
if(k==m)
{
for(int i=0;i<=m;i++)
cout<<p[i];
cout<<endl;
}
else
{
for(int i=k;i<=m;i++)
{
swap(p[k],p[i]);
Permutation(p,k+1,m);
swap(p[k],p[i]);
}
}
}
int main()
{
char s[10];
cin>>s;
Permutation(s,0,strlen(s)-1);
system("pause");
return 0;
}
#include<cstring>
using namespace std;
void Permutation(char *p,const int k,const int m)
{
if(k==m)
{
for(int i=0;i<=m;i++)
cout<<p[i];
cout<<endl;
}
else
{
for(int i=k;i<=m;i++)
{
swap(p[k],p[i]);
Permutation(p,k+1,m);
swap(p[k],p[i]);
}
}
}
int main()
{
char s[10];
cin>>s;
Permutation(s,0,strlen(s)-1);
system("pause");
return 0;
}