# -*- coding: utf-8 -*-

s = str(input())

x = int(0)
i = int(len(s))

while "01" in s:
    s=s.replace("01","")
    x = x + i- int(len(s))
    i = int(len(s))

while "10" in s:
    s=s.replace("10","")
    x = x + i- int(len(s))
    i = int(len(s))

print(x)