Java 版本
字符串排序(1)
http://www.nowcoder.com/questionTerminal/251845265711496da75c59126725f76b
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); String[] array = new String[t]; for (int i = 0; i < t; ++i) { array[i] = scanner.next(); } Arrays.sort(array); for (int i = 0; i < t; ++i) { if (i == t - 1) { System.out.println(array[i]); break; } System.out.print(array[i] + " "); } } }