S = input()

ans = 0
while True:
    if '0011' in S:
        ans += 2
        i = S.index('0011')
        S = S[: i + 1] + S[i+3:]
    elif '1010' in S:
        ans += 2
        i = S.index('1010')
        S = S[: i + 1] + S[i+3:]
    elif '0101' in S:
        ans += 2
        i = S.index('0101')
        S = S[: i + 1] + S[i+3:]
    elif '1100' in S:
        ans += 2
        i = S.index('1100')
        S = S[: i + 1] + S[i+3:]
    else:
        break

while True:
    if '01' in S:
        ans += 2
        i = S.index('01')
        S = S[: i] + S[i+2:]
    elif '10' in S:
        ans += 2
        i = S.index('10')
        S = S[: i] + S[i+2:]
    else:
        break

print(ans)
