def _kmp_construct_next(self, pattern):
                """the helper function for KMP-string-searching is to construct the DFA. pattern should be an integer array. return a 2D array representing the DFA for moving the pattern."""
                next = [[0 for state in pattern] for input_token in self.ALPHABETA_KMP]
                next[pattern[0]][0] = 1
                restart_state = 0
                for state in range(1, len(pattern)):
                        for input_token in self.ALPHABETA_KMP:
                                next[input_token][state] = next[input_token][restart_state]
                        next[pattern[state]][state] = state + 1
                        restart_state = next[pattern[state]][restart_state]
                return next
the helper function for KMP-string-searching is to construct the DFA. pattern should be an integer array. return a 2D array representing the DFA for moving the pattern.