题解 | #字符串排序#
字符串排序
http://www.nowcoder.com/practice/5af18ba2eb45443aa91a11e848aa6723
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = Integer.parseInt(sc.nextLine()); String[] arr = new String[n]; for(int i = 0; i < arr.length; i++){ arr[i] = sc.nextLine();
}
Arrays.sort(arr);
for(int j = 0; j < arr.length; j++){
System.out.println(arr[j].toString());
}
}
}
}