public boolean searchHelper(char[] words, int begin, TrieNode ptr) {
        if (begin == words.length) {
            return ptr.end;
        }
        for (int i = 0; i < 26; ++i) {
            if (ptr.children[i] == null)
                continue;
            char c = words[begin];
            if (i == c - 'a' || '.' == c)
                if (searchHelper(words, begin + 1, ptr.children[i]))
                    return true;
        }
        return false;
    }