public void addWord(String word) {
        TrieNode t = root;
        for (int i = 0; i < word.length(); i++) {
            int id = word.charAt(i) - 'a';
            if (t.children[id] == null)
                t.children[id] = new TrieNode(word.charAt(i));
            t = t.children[id];
        }
        t.isWord = true;
    }
Adds a word into the data structure.
src/problems/medium/WordDictionary.java