我需要從文本文件中讀取每行,並按照長度先對其進行排序,然後在原始文檔中對其進行排序,然後再添加行到鏈接列表。從文本文件中讀取行並將它們排序到鏈接列表中java
然後,列表中的內容必須逐行打印出來,並帶有一個前綴,用於指示正在打印輸出的行號以及該行上有多少個非空格字符。
下面是一個示例I/O:
Input (i.e. contents of text file)
this
is
just
a
test
Output
1/1: a
2/2: is
3/4: this
4/4: just
5/4: test
謝謝你,這是建議的我一直在尋找的那種! – user2328383