#include #include #include using namespace std; char input[21][25],str[500],st; char answer[100][25]; int n,res; int lenof[21]; int times[21],t2[21]; #ifdef DEBUG FILE *fout=fopen("result.txt","w"); void sync() { fflush(stdout); fflush(fout); } #endif bool equal(char* s1,char* s2,int len) { #ifdef DEBUG fprintf(fout,"\nin fuction equal: s1=%s s2=%s len=%d\n",s1,s2,len); sync(); #endif for(int i=0;ires) { printf("updated! now res=%d\n",len); printf("\t%s=%s",str,answer[0]); for(int i=1;i=n*2) return; int i,j,k,maxlen,catlen,tl; for(i=0;i2) goto addr1; } } t2[i]--; dfs(dep+1,tl); t2[i]++; addr1: continue; } } int main() { scanf("%d",&n); for(int i=0;i