s = input()
count = 0

for i in range(2):
    if not(("01" in s) | ("10" in s)):
        break
    count += 2 * s.count("01")
    s = s.replace("01", "")
    count += 2 * s.count("10")
    s = s.replace("10", "")

print(count)
