#include<queue>#include<cstdio>#include<stack>#include<iostream>#include<math.h>#include<algorithm>#include<string.h>#define N 1111using namespace std;int main(){ char s[22][20],ans[20],c; int vis[22][20]; int t,n,i,j,k,x; cin>>t; while(t--){ memset(ans,0,sizeof(ans)); memset(vis,0,sizeof(vis)); cin>>n; for(i=0;i<n;i++){ cin>>s[i]; } int l0=strlen(s[0]); x=0; for(i=0;i<l0;i++){ for(j=1;j<n;j++){ int l=strlen(s[j]); for(k=0;k<l;k++){ if(!vis[j][k] && s[0][i]==s[j][k]){ vis[j][k]=1; break; } } if(k>=l) break; } if(j>=n){ ans[x++]=s[0][i]; } } sort(ans,ans+x); for(i=0;i<x;i++) cout<<ans[i]; cout<<"n"; } return 0;}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)