Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion 031602408/wordCount/.project → 031602408/.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>wordCount</name>
<name>031602408</name>
<comment></comment>
<projects>
</projects>
Expand Down
Binary file added 031602408/bin/Main.class
Binary file not shown.
16,509 changes: 16,509 additions & 0 deletions 031602408/bin/input.txt

Large diffs are not rendered by default.

Binary file added 031602408/bin/lib/Store$1.class
Binary file not shown.
Binary file not shown.
Binary file added 031602408/src/Main.class
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
package main.java;

import java.io.BufferedReader;
import java.io.CharArrayWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
import lib.java.Store;
public class WordCount {

import lib.Store;
public class Main{
public static void main(String[] args) throws Exception {
try {
//File file = new File(args[0]);
//String pathname = file.getPath();
Scanner scanner=new Scanner(System.in);
String pathname=scanner.nextLine();
File file = new File(args[0]);
String pathname = file.getPath();
// Scanner scanner=new Scanner(System.in);
// String pathname=scanner.nextLine();
Reader myReader = new FileReader(pathname);
Reader myBufferedReader = new BufferedReader(myReader);
//���ı�����
Expand Down Expand Up @@ -54,15 +53,17 @@ public static void main(String[] args) throws Exception {
for (String word : wordsArr1) {
if(word.length() != 0){ //ȥ������Ϊ0����

while(!(word.charAt(0)>=97&&word.charAt(0)<=122))
/*while(!(word.charAt(0)>=97&&word.charAt(0)<=122))
{
word = word.substring(1, word.length());
}
if(word.length()>=4) wordcount++;
}*/
if((word.length()>=4)&&(Character.isLetter(word.charAt(0))&&Character.isLetter(word.charAt(1))&&Character.isLetter(word.charAt(2))&&Character.isLetter(word.charAt(3))))
{ wordcount++;
lists.add(word);
}
}
}
}
}



Expand Down
7 changes: 7 additions & 0 deletions 031602408/src/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
aaa
123bbb
abc123
dddd
dddd
abc123
abc123
Binary file added 031602408/src/lib/Store$1.class
Binary file not shown.
Binary file added 031602408/src/lib/Store.class
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package lib.java;
package lib;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
Expand All @@ -19,9 +20,9 @@ public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
});
try {
//System.out.println(wordcount);
File file = new File("src//result.txt");
File file = new File("result.txt");
BufferedWriter bi = new BufferedWriter(new FileWriter(file));
bi.write("characters: "+(characterscount+wordline)+"\r\n");
bi.write("characters: "+(characterscount+wordline-1)+"\r\n");
bi.write("words: "+wordcount+"\r\n");
bi.write("lines: "+wordline+"\r\n");
int k=0;
Expand Down
4 changes: 4 additions & 0 deletions 031602408/src/result.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
characters: 41
words: 2
lines: 7
<dddd>: 2
10 changes: 0 additions & 10 deletions 031602408/wordCount/bin/input.txt

This file was deleted.

Binary file removed 031602408/wordCount/bin/lib/java/Store$1.class
Binary file not shown.
Binary file removed 031602408/wordCount/bin/main/java/WordCount.class
Binary file not shown.
10 changes: 0 additions & 10 deletions 031602408/wordCount/src/input.txt

This file was deleted.

10 changes: 0 additions & 10 deletions 031602408/wordCount/src/main/java/wordCount.txt

This file was deleted.

6 changes: 0 additions & 6 deletions 031602408/wordCount/src/result.txt

This file was deleted.