from collections import deque
S =input()
counter = 0
S = list(S)
q = deque([])
for i in range(len(S)):
    q.append(S[i])
for i in range(100000):
    if q:
        s1 = q.popleft()
    else:
        break
    if q:
        s2 = q.popleft()
    else:
        break
    if(s1 != s2):
        counter+=2
    else:
        q.append(s1)
        q.appendleft(s2)
print(counter)