S = input()

if len(S) < 2:
    print('0')

else:
    # 最初に攻めていくパターンを仮ぎめ
    i = 0
    while True:
        if S[i] != S[-1-i]:
            left = S[i]
            right = S[-1-i]
            break
        i += 1
    pattern = right + left

    # マッチングして取り除いていく
    count = 0
    curr_S = S

    while True:
        count_increased = False
        new_S = ''
        j = 0
        while True:
            print(curr_S, j, curr_S[j:j+2], new_S, pattern, count)
            if curr_S[j:j+2] == pattern:
                count += 2
                j += 2
                count_increased = True
            else:
                new_S += curr_S[j]
                j += 1
            if j == len(curr_S):
                break
        # １個も見つからなかった場合はパターンを反転させて継続
        if not count_increased:
            pattern = pattern[::-1]

        # 全てが0または1になったら終了
        if '0' not in new_S or '1' not in new_S:
            break
        curr_S = new_S

    print(count)