```
//minamoto
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#define fu(a,b,c) for(int a=b;a<=c;a++)
#define fd(a,b,c) for(int a=b;a>=c;a--)
using namespace std;
const int N=55,INF=0x3f3f3f3f;
bool v[N][N],used[N];
int ans[N*N],stack[N*N],k[N];
int n,t,top,c[5],p,m;
int read()
{
int x=0,f=1;
char c=getchar();
for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
for(;isdigit(c);c=getchar()) x=x*10+c-'0';
return x*f;
}
int num(char c){
if(c>='A'&&c<='Z') return c-'A';
return c-'a'+26;
}
char ch(int x){
if(x>=0&&x<=25) return x+'A';
return x-26+'a';
}
void dfs(int x){
used[x]=true;
m--;
fu(i,0,51)
if(v[x][i]&&!used[i]) dfs(i);
}
void enler(int x){
top=0;
stack[++top]=x;
while(top){
int x=stack[top];
bool flag=true;
fu(i,0,51)
if(v[x][i]){
flag=false;
v[x][i]=v[i][x]=false;
stack[++top]=i;
break;
}
if(flag){
top--;
ans[++t]=x;
}
}
}
int main(){
n=read();
fu(i,1,n){
char x,y;
while((x=getchar())=='\n');
y=getchar();
v[num(x)][num(y)]=true;
v[num(y)][num(x)]=true;
k[num(x)]++,k[num(y)]++;
if(k[num(x)]==1) m++;
if(k[num(y)]==1) m++;
}
fu(i,0,51)
if(k[i]){
dfs(i);
if(m){
printf("No Solution");
return 0;
}
break;
}
fu(i,0,51){
if(k[i]&1) c[++p]=i;
if(p>2){
printf("No Solution");
return 0;
}
}
if(!p){
fu(i,0,51)
if(k[i]){
enler(i);
break;
}
}
else if(p==1) enler(c[p]);
else enler(min(c[p-1],c[p]));
fd(i,t,1) cout<<ch(ans[i]);
return 0;
}
```
by bztMinamoto @ 2018-06-18 07:13:32
同上,求助dalao我都快急死了
by 少帅_zjm @ 2018-06-18 15:28:56
@[bztMinamoto](/space/show?uid=41781)
一般是\0的问题。。。你可能多了个空格,或\0与标准输出位置不一样
by Carbon @ 2018-07-20 19:45:50
@[mzjmzj666](/space/show?uid=32113) 多谢,已解决
by bztMinamoto @ 2018-07-21 08:06:54
@[bztMinamoto](/space/show?uid=41781)
不用谢我,请叫我雷锋
by Carbon @ 2018-07-21 09:47:45
@[mzjmzj666](/space/show?uid=32113)
呸,红领巾
by Carbon @ 2018-07-21 09:48:35