diff options
Diffstat (limited to 'others/easy20160714/19.c')
-rw-r--r-- | others/easy20160714/19.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/others/easy20160714/19.c b/others/easy20160714/19.c new file mode 100644 index 0000000..903fc77 --- /dev/null +++ b/others/easy20160714/19.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <string.h> + +int main() +{ + FILE *f = fopen("INP.TXT", "r"); + char x[100001], y[100001]; + long i, m, n, r = -1; + + fscanf(f, "%s %s", x, y); + fclose(f); + + m = strlen(x); + n = strlen(y) - m; + for (i = 0; i < n; i++) + if (!strncmp(x, y + i, m)) { + r = i + 1; + break; + } + + f = fopen("OUT.TXT", "w"); + fprintf(f, "%ld\n", r); + fclose(f); + + return 0; +} |