import java.util.Scanner;
import java.io.File;
import java.io.IOException;
public class Dictionary {
public static void main(String [] args)
throws IOException{
System.out.println("Loading dictionary");
BinarySearchTree<String> dict
=new BinarySearchTree<String>();
Scanner words=
new Scanner(new File(args[0]));
int count=0;
while(words.hasNext()){
dict.insert(words.next().toLowerCase());
count++;
if (count % 1000 == 0)
System.out.println("Read "+ count);
}
System.out.print("Ready: ");
Scanner query = new Scanner(System.in);
while (query.hasNext()){
String word = query.next().toLowerCase();
if (dict.search(word))
System.out.println(word +
" found.");
else
System.out.println(word +
" not found. ");
System.out.print("Ready: ");
}
}
}