Here is the source code of the bfSM algorithm. The program should display the starting index of the part where a total match with the pattern is found, or -1 if there are no matches in the given text. I tried including all the libraries i've used thus far while programming but when I debug the program nothing is displayed on the console except for "(process 15936) exited with code 0". I'm not sure what exactly am I missing here an would appreciate some help.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include<stdio.h>
#include<string.h>
using namespace std;
int bruteForceSM(string p, string t) {
for (int i = 0; i < (t.size() - p.size()); i++) {
int j = 0;
while(j < p.size() && p[j] == t[i + j]) { j++; }
if (j == p.size()) { return i; }
}
return -1;
}
int main(){
string text = "sally sells seashells by the seashore";
string pattern = "shell";
bruteForceSM(pattern, text);
return 0;
}