#include<iostream> #include<algorithm> #define MAXN 26 #define MAX 300 using namespace std; bool floy[MAXN][MAXN]; char var[MAX]; char cons[MAX]; int a[MAXN]; void tran_var(); void give_floy(); bool is_ok(); void floyd(); int main() { //freopen("acm.acm","r",stdin); int len; while(gets(var)) { memset(floy,false,sizeof(floy)); memset(a,0,sizeof(a)); gets(cons); tran_var(); // cout<<var<<endl; give_floy(); floyd(); len = strlen(var); // cout<<len; sort(var,var + len); do { //cout<<"0000000000"<<endl; if(is_ok()) cout<<var<<endl; }while(next_permutation(var,var+len)); cout<<endl; } } void tran_var() { int i; int j; int len = strlen(var); for(i = 0,j = 0; i < len; i += 2) { var[j] = var[i]; ++ j; } var[j] = '