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