1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
def pal_moves(seq):
    wrong = 0
    n = len(seq)
    for i in range(n // 2):
        if seq[i] != seq[n - i - 1]:
            wrong += 1
    if n % 2 == 0:
        if wrong % 2 == 0:
            return wrong // 2
        else:
            return -1
    else:
        if wrong % 2 == 0:
            return wrong // 2
        return wrong // 2 + 1

a = input()
print(pal_moves(a))