import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()
n = len(s)

cursor = 0
prev = ""
ans = 0

while cursor < n:
    cur = s[cursor]
    
    if cur != prev:
        prev = cur
        cursor += 1
        
    else:
        left = cursor-1
        right = cursor
        
        while left >= 0 and right < n:
            if s[left] != s[right]:
                break
            
            ans += 2
            left -= 1
            right += 1
            
        cursor = right
        prev = ""
        
print(ans)