package mypackage;

public class display {

    public static void main(String[] args) throws Exception {
        System.out.println("信1705-1\t20173618\t李嘉兴");

        find find=new find();
        
        find.find();
        

    }

}

package mypackage;
import java.util.Scanner; 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.BufferedReader;
public class find {
    void find() throws Exception
    {
                    
        File file = new File("C:\\\\Users\\\\xxoo\\\\Documents\\\\test.txt");
        FileReader reader =new FileReader(file);
        
        int fileLen = (int)file.length();
        char[] chars = new char[fileLen];
        reader.read(chars);        
        String txt = String.valueOf(chars);
        String[] a=txt.split("[^a-zA-Z]+");
        int n=a.length;
        int nind=0,wind=0;
        Object[][] b=new Object[n][2];
        for(;wind<n;wind++){
            int k=0;
            for(int i=0;i<nind;i++){

                if(((String) b[i][0]).equalsIgnoreCase(a[wind])){

                    b[i][1]=(int)b[i][1]+1;

                    k=1;

                    break;

                }
            }   
            if(k==0){
                b[nind][0]=a[wind];
                b[nind][1]=1;
                nind++;
            } 
        } 
        BufferedReader br1=new BufferedReader(new FileReader("C:\\Users\\xxoo\\Documents\\test.txt"));
        String str=br1.readLine();
        String[] arg=str.split("[^a-zA-Z]+");
        int m=arg.length;
        for(int i=0;i<nind;i++){
            for(int j=0;j<m;j++ ){
                if(((String) b[i][0]).equalsIgnoreCase(arg[j])){
                    b[i][1]=0;
                }
            }
        }
        for(int i=0;i<10;i++){
            int max=0;
            for(int j=0;j<nind;j++){
                if((int)b[j][1]>(int)b[max][1]){
                    max=j;
                }
            }
                System.out.println(b[max][0]+"出现次数为:"+b[max][1]);
                b[max][1]=0;
            }
    }

}