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