public int search(String docs) {
		
		int i, j, M = pattern.length(), N = docs.length();
		
		for (i = 0, j = 0; i < N && j < M; i++) {
			j = dfa[docs.charAt(i)][j];
		}
		
		if (j == M) return i - M;
		else return N;
	}