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(len(S)):
    if q:
        s1 = q.popleft()
        s2 = q.popleft()
        if(s1 != s2):
            counter+=2
        else:
            q.append(s1)
            q.appendleft(s2)
    else:
        break
print(counter)