HiddenText/sus801 | HiddenText/Stephan | ||||
---|---|---|---|---|---|
f | 1 | x = input() | f | 1 | x = input() |
2 | y = input() | 2 | y = input() | ||
3 | z = False | 3 | z = False | ||
4 | 4 | ||||
5 | if len(y) > len(x): | 5 | if len(y) > len(x): | ||
6 | print("NO") | 6 | print("NO") | ||
7 | elif len(y) == 0: | 7 | elif len(y) == 0: | ||
8 | print("YES") | 8 | print("YES") | ||
9 | elif len(y) == 1: | 9 | elif len(y) == 1: | ||
10 | if y in x: | 10 | if y in x: | ||
11 | print("YES") | 11 | print("YES") | ||
12 | else: | 12 | else: | ||
13 | print("NO") | 13 | print("NO") | ||
14 | else: | 14 | else: | ||
n | 15 | for n in range(len(x)): | n | 15 | for i in range(len(x)): |
16 | if z: | 16 | if z: | ||
17 | break | 17 | break | ||
n | 18 | if x[n] == y[0]: | n | 18 | if x[i] == y[0]: |
19 | for k in range(n+1, len(x)): | 19 | for k in range(i+1, len(x)): | ||
20 | if z: | 20 | if z: | ||
21 | break | 21 | break | ||
22 | if x[k] == y[1]: | 22 | if x[k] == y[1]: | ||
n | 23 | j = k-n | n | 23 | j = k-i |
24 | 24 | ||||
n | 25 | ab = x[n:n+j*(len(y)):j] | n | 25 | p = x[i:i+j*(len(y)):j] |
26 | 26 | ||||
t | 27 | if ab == y: | t | 27 | if p == y: |
28 | z = True | 28 | z = True | ||
29 | 29 | ||||
30 | if z: | 30 | if z: | ||
31 | print('YES') | 31 | print('YES') | ||
32 | else: | 32 | else: | ||
33 | print('NO') | 33 | print('NO') | ||
34 | 34 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|