#include <stdio.h> #include <math.h> #include <string.h> int main(){ char str1[100000]; char str2[100000]; while(scanf("%s",str1)!=EOF){ //getchar(); scanf("%s",str2); //getchar(); char *sign=strstr(str1,str2); if(sign!=NULL){ printf("%d\n",sign-str1+1); }else{ printf("-1\n"); } } return 0; } |
Double click to view unformatted code.