Untitled

mail@pastecode.io avatar
unknown
plain_text
13 days ago
464 B
2
Indexable
Never
#include<iostream>
using namespace std;
int main()
{
    string  s,p;
    cin>>s>>p;

    int Ls=s.size();
    int Lp=p.size();

    int Max=(Ls-Lp)+1;

    for(int i=1;i<Max;i++){

        bool flag=true;

        for(int j=1;j<Lp&&flag==true;j++){

            if(p[i]!=s[j+i-1]){
                flag=false;
            }
        }
        if(flag==true){
           cout<< i;
            break;
}    }






    return 0;
}

Leave a Comment