编辑代码

int Imdex_BF(string S,string T,int pos)
{
    int i=pos;int j=0;
    while (i < S.length())
    {
        j=0;
        while (j < T.length()){
            if(S[i+j]==T[j]){++j;}
            else{break;}
        }
        if (j == T.length()) return i;

        ++i;
    }

    return -1;

}