#include <stdio.h> #include <string.h> #define maxSize 100000 int main(int argc, char *argv[]) { char c[maxSize]; char s[maxSize]; while(scanf("%s %s",c,s)!=EOF){ char *p = strstr(c,s); if(p) printf("%d\n",(int)(p-c)+1); else { printf("-1\n"); } } return 0; } |
Double click to view unformatted code.