about summary refs log tree commit diff
path: root/others/easy20160714/19.c
blob: 903fc7702a40c0c3b4456c5b937b7ef1c44bde57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}