list input split for in range len if 97 ord 122 or 65 ord 90 elif for

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n = list(input().split('#')[0])+['#']
t = 0
for i in range(len(n)):
if 97 <= ord(n[i]) <= 122 or 65 <= ord(n[i]) <= 90:
t += 1
elif t != 0:
for j in range(i-t,i):
if 97 <= ord(n[j]) <= 122:
n[j] = chr((ord(n[j])+t-97)%26+97)
elif 65 <= ord(n[j]) <= 90 :
n[j] = chr((ord(n[j])+t-65)%26+65)
t = 0
for i in range(len(n)):
print(n[i],end ='')