-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDriver.java
More file actions
42 lines (39 loc) · 912 Bytes
/
Copy pathDriver.java
File metadata and controls
42 lines (39 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.*;
import java.io.*;
public class Driver
{
public static void outputWordlist()
{
try
{
DictionaryTree dt = new DictionaryTree();
Scanner in = new Scanner(new File("wordlist.txt"));
while (in.hasNext())
{
String word = in.nextLine().trim().toLowerCase();
dt.add(word);
}
System.out.print(dt.getTreeCode());
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static void main(String[] args)
{
try
{
Scanner in = new Scanner(new File("words"));
DictionaryTree dt = new DictionaryTree(in.next());
for (String ending : dt.getPossibleEndings("chee"))
{
System.out.println(ending);
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}