#include<cstdio>
#include<iostream>
using namespace std;
const int maxn = 2000 + 5;
int N;
char S[maxn];
void solve() {
bool left = false;
int x = 0;
int y = N - 1;
int cnt = 0;
while (x <= y) {
bool left = false;
for (int i = 0; x + i < y; i++) {
if (S[x + i] < S[y - i]) {
left = true;
break;
}
else if (S[x + i] > S[y - i]) {
left = false;
break;
}
}
if (left) putchar(S[x++]);
else putchar(S[y--]);
cnt++;
if(cnt == 80){
putchar('\n');
cnt = 0;
}
}
}
int main() {
while (scanf("%d", &N) == 1) {
getchar();
for (int i = 0; i < N; i++) {
scanf("%c", &S[i]);
getchar();
}
solve();
}
return 0;
}
POJ3617
最新推荐文章于 2024-08-15 17:28:13 发布