private int search(Node x, String query, int d, int length) {
		if (x == null) return length;
		if (x.val != null) length = d;
		if (d == query.length()) return length;
		
		char c = query.charAt(d);
		return search(x.next[c], query, d + 1, length);
	}