from collections import deque

b = deque(map(int, input()))
cnt = 0
while len(b) > 1:

    if len(list(set(b))) == 1:
        break
    if b[0] != b[1]:
        b.popleft()
        b.popleft()
        cnt += 1
        continue
    b.append(b.popleft())

print(cnt * 2)
