Java 版
字符串排序(3)
http://www.nowcoder.com/questionTerminal/0588d343472e42a9af1eda9a69912df3
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] + ","); } } } }