View Code of Problem 3832

#include <stdio.h>
#include <string.h>

char str1[100001],str2[100001];

int main() {
    char *j;
    while(gets(str1)!=NULL) {
        gets(str2);
        j = strstr(str1, str2);
        if(j!=0) {
            printf("%d\n",(int)(j-str1)+1);
        }
        else {
            printf("-1\n");
        }
    }
}

Double click to view unformatted code.


Back to problem 3832