#include <stdio.h> #include <string.h> char str1[100050],str2[100050]; int main() { int i; int j; while(scanf("%c",str1)!=EOF) { i=0; do { i++; scanf("%c",&str1[i]); }while(str1[i]!=' '&&str1[i]!='\n'); str1[i]=0; i=-1; do { i++; scanf("%c",&str2[i]); }while(str2[i]!=' '&&str2[i]!='\n'); str2[i]=0; j = strstr(str1, str2)-str1; if(j>=0) { printf("%d\n",j+1); } else { printf("-1\n"); } } } |
Double click to view unformatted code.