import re
S = input()
cnt = 0

while True:
    if re.search("01", S) is None and re.search("10", S) is None:
        break
    length = len(S)
    S = re.sub("01", "", S)
    cnt += length - len(S)
    length = len(S)
    S = re.sub("10", "", S)
    cnt += length - len(S)
print(cnt)