#include<cstdio>
#include<string>
using namespace std;
char ch[30030]={};
int main()
{
freopen("bclgold.out","w",stdout);
freopen("bclgold.in","r",stdin);
int n,i=0;
scanf("%d",&n);
while(scanf("%c",&ch[i])==1)
if('A'<=ch[i]&&ch[i]<='Z')i++;
int l=0,r=n-1;
int ll=l,rr=r;
for (i=0;i<n;i++)
{
if (!i%80&&i) printf("\n");
if (ch[l]==ch[r])
{
if (ll-l>0&&ll-l==r-rr)
{
if (ch[ll]<ch[rr])
printf("%c",ch[l++]);
else printf("%c",ch[r--]);
continue;
}
ll=l,rr=r;
while(ll<rr&&ch[ll]==ch[rr])
{
ll++;
rr--;
}
if (ch[ll]<ch[rr])
printf("%c",ch[l++]);
else printf("%c",ch[r--]);
}
else
if (ch[l]<ch[r]) printf("%c",ch[l++]);
else if (ch[l]>ch[r]) printf("%c",ch[r--]);
}
return 0;
}