wrong answer(python)
Posted by
dkzzum 25 Jan 2023 01:44
I checked several times and everything is working correctly, help me
def encryption(txt):
cipher = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
encryption_list = []
for i in txt:
encryption_list.append(cipher[i])
c = d = c1 = 0
encryption_last_list = []
for i in encryption_list:
if d == 0:
d += 1
c = i
i -= 5
if i < 0:
i = 25 - abs(i)
encryption_last_list.append(i)
else:
c1 = i
i -= c
c = c1
if i < 0:
i = 26 - abs(i)
encryption_last_list.append(i)
decodding_list = []
for i in encryption_last_list:
for k, v in cipher.items():
if v == i:
decodding_list.append(k)
return decodding_list
text = input()
if len(text) <= 99:
c = ''
output = encryption(text.lower())
for i in output:
c += i
print(c)