Source Code
import math

s = input()
s = s.strip()
size = len(s)
count = 0
mini = 100000
base = None

for i in s:
    count = 0
    base = i
    for j in s:
        diff = ord(base) - ord(j)
        count = count + abs(diff)
    if mini > count:
        mini = count

print(mini)
Copy
Palindrome Substrings jester
GNU G++17
0 ms
0 KB
Compilation Error