mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
docs: update the whole repository
* fix some bugs * delete duplicate files * format code
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
package Others;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
@@ -24,8 +26,8 @@ public class TopKWords {
|
||||
in = fis.read(); // read one character
|
||||
|
||||
while (-1 != in) {
|
||||
if (Character.isLetter((char)in)) {
|
||||
s += (char)in; //if get a letter, append to s
|
||||
if (Character.isLetter((char) in)) {
|
||||
s += (char) in; //if get a letter, append to s
|
||||
} else {
|
||||
// this branch means an entire word has just been read
|
||||
if (s.length() > 0) {
|
||||
@@ -56,6 +58,7 @@ public class TopKWords {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// you can replace the filePath with yours
|
||||
CountWords cw = new CountWords("/Users/lisanaaa/Desktop/words.txt");
|
||||
|
||||
Reference in New Issue
Block a user