private boolean dfs(Map<Character, TrieNode> children, String word,
			int index) {
		if (index == word.length())
			return children.isEmpty();
		char ch = word.charAt(index);
		if (children.containsKey(ch)) {
			if (index == word.length() - 1 && children.get(ch).isWord)
				return true;
			return dfs(children.get(ch).children, word, index + 1);
		} else if (ch == '.') {
			boolean res = false;
			for (TrieNode node : children.values()) {
				if (node.isWord && index == word.length() - 1)
					return true;
				if (dfs(node.children, word, index + 1))
					res = true;
			}
			return res;
		} else
			return false;
	}