промежутое
This commit is contained in:
24
programm10.py
Normal file
24
programm10.py
Normal file
@@ -0,0 +1,24 @@
|
||||
f = open('INPUT.TXT')
|
||||
s = f.read().strip()
|
||||
f.close()
|
||||
|
||||
def is_palindrome(string):
|
||||
return string == string[::-1]
|
||||
|
||||
result = ""
|
||||
|
||||
if not is_palindrome(s):
|
||||
result = s
|
||||
elif len(s) > 1:
|
||||
if not is_palindrome(s[:-1]):
|
||||
result = s[:-1]
|
||||
elif not is_palindrome(s[1:]):
|
||||
result = s[1:]
|
||||
else:
|
||||
result = "NO SOLUTION"
|
||||
else:
|
||||
result = "NO SOLUTION"
|
||||
|
||||
f = open('OUTPUT.TXT', 'w')
|
||||
f.write(result)
|
||||
f.close()
|
||||
Reference in New Issue
Block a user