Ответ:
import itertools
def antipalindrom():
with open('input.txt', 'r') as file:
line = file.read()
array = []
antpal = []
for i in range(len(line)):
i+=1
array.append(list(itertools.combinations(line, i))[0])
array = [(lambda i: ''.join(i))(i) for i in array]
for item in array:
if item != item[::-1]:
antpal.append(item)
with open('output.txt', 'w') as f:
if not antpal:
f.write('NO SOLUTIONS')
else:
f.write(antpal[-1])
antipalindrom()
Объяснение:
Python 3.7
tg = @Fr0DK
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
import itertools
def antipalindrom():
with open('input.txt', 'r') as file:
line = file.read()
array = []
antpal = []
for i in range(len(line)):
i+=1
array.append(list(itertools.combinations(line, i))[0])
array = [(lambda i: ''.join(i))(i) for i in array]
for item in array:
if item != item[::-1]:
antpal.append(item)
with open('output.txt', 'w') as f:
if not antpal:
f.write('NO SOLUTIONS')
else:
f.write(antpal[-1])
antipalindrom()
Объяснение:
Python 3.7
tg = @Fr0DK