@@ -0,0 +1,414 @@
+def solution(s):%0A    i = 0%0A    j = len(s) - 1%0A    %0A    while i %3C j:%0A        if s%5Bi%5D == s%5Bj%5D:%0A            i += 1%0A            j -= 1%0A        else:%0A            t = s%5Bi + 1:j + 1%5D%0A%0A            if t == t%5B::-1%5D:%0A                return i%0A            else:%0A                return j%0A    %0A    return -1%0A%0AtestCount = int(input())%0A%0Afor testId in range(testCount):%0A    s = input().strip()%0A    i = solution(s)%0A    %0A    print(i)%0A

Create solution.py