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