int bp_search(char *text, char *pattern) {
int i, j, k, len_text, len_pattern;
len_text = strlen(text);
len_pattern = strlen(pattern);
for (i = 0; i < len_text - len_pattern + 1; i++) {
for (j = 0; j < len_pattern; j++) {
if (text[i + j] != pattern[j]) {
break;
}
}
if (j == len_pattern) {
return i;
}
}
return -1;
}