string = input()

def take_zero_one(target, cnt=0):
    if len(target) <= 1:
        return (target, cnt)
    elif len(set(target)) == 1:
        return (target, cnt)

    prev = target[0]
    idx = 1
    while idx < len(target):
        if prev != target[idx]:
            cnt += 2
            remaining = target[:idx-1] + target[idx+1:]
            break

        prev = target[idx]
        idx += 1

    remaining, cnt = take_zero_one(remaining, cnt)

    return (remaining, cnt)

_, cnt = take_zero_one(string)
print(cnt)