uva10905

来源:互联网 发布:598营销软件 编辑:程序博客网 时间:2024/05/19 13:09
import java.util.*;


public class Main{

public static void main(String [] args){
Scanner input = new Scanner(System.in);
String [] fun = new String [55];

int n = input.nextInt();
while(n != 0){
for(int i = 0; i < n; i++){
fun[i] = input.next();
for(int j = i; j > 0; j--){
if(maxx(fun[j],fun[j - 1])){
String temp = fun[j];
fun[j] = fun[j - 1];
fun[j - 1] = temp;
}
else
break;
}
}
for(int i = 0; i < n; i++)
System.out.print(fun[i]);
System.out.println();
n = input.nextInt();
}
}
public static boolean maxx(String a,String b){
if((a + b).compareTo((b + a)) > 0)
return true;
else 

return false;

//123  1234   1234>123

}
}
0 0
原创粉丝点击