llilyshkall PatternFind 6541 | Илья Федоров, 617 группа PatternFind 5475 | ||||
---|---|---|---|---|---|
n | 1 | s = input() | n | 1 | tar = input() |
2 | pattern = input() | 2 | pat = input() | ||
3 | ans = -1 | 3 | position = -1 | ||
4 | for i in range(len(s) - len(pattern) + 1): | 4 | for i in range(len(tar) - len(pat) + 1): | ||
5 | check = True | 5 | match = True | ||
6 | for j in range(len(pattern)): | 6 | for j in range(len(pat)): | ||
7 | if pattern[j] != '@': | 7 | if pat[j] != '@' and tar[i + j] != pat[j]: | ||
8 | if s[i + j] != pattern[j]: | ||||
9 | check = False | 8 | match = False | ||
10 | break | 9 | break | ||
11 | if check: | 10 | if match: | ||
12 | ans = i | 11 | position = i | ||
13 | break | 12 | break | ||
t | 14 | print(ans) | t | 13 | print(position) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|