Тулинова Олеся Вадимовна, 442 группа FragEncode 9187
Хайруллина Алина FragEncode 9786
f1import sysf1import sys
n2data = sys.stdin.buffer.read()n2raw_data = sys.stdin.buffer.read()
3chunks = data.split(b'\x00')3parts = raw_data.split(b'\x00')
4utf8_text = chunks[0].decode('utf-8')4main_text = parts[0].decode('utf-8')
5fragments = chunks[1:-1]5segments = parts[1:-1]
6encodings = ['cp866', 'cp1251', 'koi8_r', 'iso-8859-5']6codepages = ['cp866', 'cp1251', 'koi8_r', 'iso-8859-5']
7for frag in fragments:7for item in segments:
8    found = False8    matched = False
9    for enc in encodings:9    for cp in codepages:
10        try:10        try:
n11            decoded = frag.decode(enc)n11            txt = item.decode(cp)
12        except UnicodeDecodeError:12        except UnicodeDecodeError:
13            continue13            continue
n14        if decoded in utf8_text:n14        if txt in main_text:
15            found = True15            matched = True
16            break16            break
t17    print('Yes' if found else 'No')t17    print('Yes' if matched else 'No')
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op