C++简单实现
串的模式匹配
http://www.nowcoder.com/questionTerminal/084b6cb2ca934d7daad55355b4445f8a
C++实现
for (int i = 0;i<lena;i++) { int j = 0, k = i; while (A[k] == B[j]) { j++; k++; } if (B[j] == '\0') { return i; } } return -1;
串的模式匹配
http://www.nowcoder.com/questionTerminal/084b6cb2ca934d7daad55355b4445f8a
C++实现
for (int i = 0;i<lena;i++) { int j = 0, k = i; while (A[k] == B[j]) { j++; k++; } if (B[j] == '\0') { return i; } } return -1;
相关推荐