public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringBuilder output = new StringBuilder(); int cases = Integer.parseInt(bf.readLine()); for (int i = 0; i < cases; i++) { bf.readLine(); // blank-line char[][] boogle = new char[4][4]; for (int j = 0; j < 4; j++) { boogle[j] = bf.readLine().trim().toUpperCase().toCharArray(); } String n = ""; while (n.equals("")) { n = bf.readLine().trim(); } int noWords = Integer.parseInt(n); Trie t2 = new Trie(); for (int j = 0; j < noWords; j++) { t2.addWord(bf.readLine().trim().toUpperCase()); } output.append("Score for Boggle game #" + (i + 1) + ": " + calculateScore(boogle, t2) + "\n"); } System.out.print(output); }
public WordList() { System.out.println(System.getProperty("user.dir")); String path = System.getProperty("user.dir"); String fullPath = path + "\\sowpods.txt"; // String triePath = path + "\\trie"; myPrefixTrie = new Trie(); mySuffixTrie = new Trie(); try (BufferedReader br = new BufferedReader(new FileReader(fullPath))) { String word = br.readLine(); while (word != null) { // System.out.println(word); myPrefixTrie.addWord(word); word = br.readLine(); } } catch (Exception e) { } }