1 /*
2 作者:1348066599@qq.com
3 题目:p1204 寻找子串位置
4 */
5
6 #include <stdio.h>
7 #include <algorithm>
8 #include <iostream>
9 #include <string.h>
10 #include <string>
11 #include <math.h>
12 #include <stdlib.h>
13 #include <queue>
14 #include <stack>
15 #include <set>
16 #include <map>
17 #include <list>
18 #include <iomanip>
19 #include <vector>
20 #pragma comment(linker, "/STACK:1024000000,1024000000")
21 #pragma warning(disable:4786)
22
23 using namespace std;
24
25 const int INF = 0x3f3f3f3f;
26 const int MAX = 10000 + 10;
27 const double eps = 1e-8;
28 const double PI = acos(-1.0);
29
30 int main()
31 {
32 char str[101] , str1[101];
33 while(cin >> str >> str1)
34 {
35 int i , j , ans = 0;
36 int len = strlen(str);
37 int len1 = strlen(str1);
38 for(i = 0;i < len - len1 + 1;i ++)
39 {
40 int ii = i , k = 0;
41 for(j = 0;j < len1;j ++)
42 if(str1[j] == str[ii ++])
43 k ++;
44 else
45 break;
46 if(j == len1)
47 {
48 ans = i + 1;
49 break;
50 }
51 }
52 printf("%d\n",ans);
53 }
54 return 0;
55 }