Untitled
unknown
plain_text
a year ago
464 B
6
Indexable
#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; }
Editor is loading...
Leave a Comment