import java.io.File;import java.util.Scanner;import java.util.ArrayList;public class Question5Lite{public static void main(String[]args){File foobar;Scanner input;foobar=new File("files\\callw10.txt");try{input=new Scanner(foobar);input.useDelimiter("([^a-zA-Z]+)");String buffer;ArrayList<String>words=new ArrayList<String>();ArrayList<Integer>counts=new ArrayList<Integer>();while(input.hasNext()){buffer=input.next().toLowerCase();if(words.indexOf(buffer)==-1){if(words.isEmpty()){words.add(buffer);counts.add(1);}else{int i=0;while(i<=words.size()){if(i>=words.size()){words.add(buffer);counts.add(1);break;}else if(buffer.compareTo(words.get(i))<0){words.add(i,buffer);counts.add(i,1);break;}else{i++;}}}}else{counts.set(words.indexOf(buffer),counts.get(words.indexOf(buffer))+1);}}input.close();System.out.format("%-20s%-1s\n","WORD","OCCURENCES");for(int i=0;i<words.size();i++){System.out.format("%-20s%-1s\n",words.get(i),counts.get(i));}}catch(java.io.FileNotFoundException e){System.err.println("Error: file "+foobar+" not found.");e.getMessage();System.exit(1);}}}