import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static char[] ch;
public static void main(String[] args) {
while (sc.hasNext()) {
int n = sc.nextInt();
String str = "";
sc.nextLine();
while(n-- > 0) {
str += sc.nextLine();
}
generate(str);
}
}
public static void generate(String str) {
String ans = "";
ch = str.toCharArray();
int l = 0;
int r = str.length() - 1;
while (l != r && l < ch.length && r < ch.length) {
if(CompareTwo(l, r)) {
ans += ch[l];
l++;
}
else {
ans += ch[r];
r--;
}
}
ans += ch[r];
System.out.println(ans);
}
public static boolean CompareTwo(int l, int r) {
// return true;
return (ch[l] < ch[r]);
}
}
poj 3617
最新推荐文章于 2019-01-19 21:58:17 发布