import itertools
t = input()
palindrom = False
brojac = 0
a = ''
if t == t[::-1]:
    print(1)
else:
    while t[0] == t[-1]:
        t = t[1:-1]
    while palindrom == False:
        brojac += 1
        y = 0
        for i in range(len(t) - brojac):
            for x in range(brojac + 1):
                a += t[x + y]
            slova = list(a)
            permutacije = list(itertools.permutations(slova))
            listaPermutacija = [''.join(permutation) for permutation in permutacije]
            for k in listaPermutacija[1:]:
                duzina = len(k)
                testString = t[:y] + k + t[y + duzina:]
                if testString == testString[::-1]:
                    palindrom = True
                    print(duzina)
                if palindrom:
                    break
            if palindrom:
                break 
            y += 1
            a = ''