}publicstaticintKMPByNext(String txt, String pat){if(pat.length() ==0)return0;int[] next = getNext(pat);inti=0, j =0;while(i < txt.length() && j < pat.length()) {//next值为-1,txt右移动一位,pat移动整个长度(j++=0)//如果匹配成功,继续将txt,pat的下一个元素进行匹配if(j =...