-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwap.py
27 lines (26 loc) · 897 Bytes
/
Swap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#input hEY3 a7yY5O, wHa3t f8as9O
def ShiftLet(take):
resultant = ""
for i in take:
if i == i.upper():
i = i.lower()
resultant += i
elif i == i.lower():
i = i.upper()
resultant += i
else:
resultant += i
for i in range(len(resultant)-1, len(resultant) // 2, -1):
storeA, indexA = 0, 0
if resultant[i].isnumeric():
storeA = resultant[i]
indexA = resultant.index(resultant[i])
break
for j in range(len(resultant)-1, len(resultant) // 2, -1):
storeB, indexB = 0, 0
if resultant[j].isnumeric():
storeB = resultant[j]
indexB= resultant.index(resultant[j])
resultant = resultant[:indexB] + storeA + resultant[indexB+1:indexA] + storeB + resultant[indexA+1:]
return resultant
print(ShiftLet(str(input())))