Игорь Дудка, 508 группа HiddenText 1742
Морозов Максим 508 HiddenText 1821
t1def main():t1def main():
2    text = input()2    text = input()
3    pattern = input()3    pattern = input()
4    (text_len, pat_len) = (len(text), len(pattern))4    (text_len, pat_len) = (len(text), len(pattern))
5    if pat_len > text_len:5    if pat_len > text_len:
6        print('NO')6        print('NO')
7        return7        return
8    if pat_len == 0:8    if pat_len == 0:
9        print('YES')9        print('YES')
10        return10        return
11    (i, j, step, cur_begin) = (0, 0, 0, 0)11    (i, j, step, cur_begin) = (0, 0, 0, 0)
12    flag = False12    flag = False
13    while i < text_len:13    while i < text_len:
14        while i < text_len and text[i] != pattern[j]:14        while i < text_len and text[i] != pattern[j]:
15            i += 115            i += 1
16        if i >= text_len:16        if i >= text_len:
17            print('NO')17            print('NO')
18            return18            return
19        else:19        else:
20            cur_begin = i20            cur_begin = i
21            j += 121            j += 1
22            if j >= pat_len:22            if j >= pat_len:
23                print('YES')23                print('YES')
24                return24                return
25            while i < text_len and text[i] != pattern[j]:25            while i < text_len and text[i] != pattern[j]:
26                i += 126                i += 1
27                step += 127                step += 1
28            if i >= text_len:28            if i >= text_len:
29                print('NO')29                print('NO')
30                return30                return
31            else:31            else:
32                while i < text_len and j < pat_len and (text[i] == pattern[j]):32                while i < text_len and j < pat_len and (text[i] == pattern[j]):
33                    j += 133                    j += 1
34                    i += step34                    i += step
35                if j == pat_len:35                if j == pat_len:
36                    print('YES')36                    print('YES')
37                    return37                    return
38                else:38                else:
39                    i = cur_begin + 139                    i = cur_begin + 1
40                    step = 040                    step = 0
41                    j = 041                    j = 0
42    print('NO')42    print('NO')
43if __name__ == '__main__':43if __name__ == '__main__':
44    main()44    main()
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op