#include <bits/stdc++.h>
using namespace std;
int num;
string sti,t;
int main()
{
cin>>num;
cin>>sti;
for(unsigned long long qa=1;qa<num;qa++)
{
cin>>t;
long long l=sti.length();
long long lt=t.length();
long long gg=0;
char q=sti[l-1];
for(long long i=min(lt-1,l-1);i>=0;i--)
{
while(t[i]!=q&&i<lt&&i<l)
i--;
bool is_be=true;
for(long long j=1;j<=i&&is_be;j++)
{
if(t[i-j]!=sti[l-1-j])
is_be=false;
}
if(is_be)
{
gg=i+1;
break;
}
}
sti=sti.substr(0,l-gg);
sti=sti+t;
}
cout<<sti;
}a
文章信息与版本
文章信息
- 收录
- 2025年12月12日
- 更新
- 2025年12月12日
- 篇幅
- 约 1 分钟