s = list(map(int, input().strip()))
len_s = len(s)

p = 0
count = 0

while p < len(s) - 1:
    if s[p] != s[p + 1]:
        count += 2
        first = s[:p] if p > 0 else []
        second = s[p + 2:] if p < len(s) - 2 else []
        s = first + second
        if p > 0:
            p -= 1
        else:
            p = 0
    else:
        p += 1

print(count)
