#include<iostream> #include<cstring> #include<math.h> #include<algorithm> using namespace std; int main(){ char ch[100010],ch2[10010]; while(scanf("%s %s",ch,ch2)!=EOF){ char* i=strstr(ch,ch2); if(i==0) printf("-1\n"); else { printf("%d\n",i-ch+1); } } return 0; } |
Double click to view unformatted code.