%%time

import re

dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]

l = str(input())
cnt = 0

while "10" in l or "01" in l:
    dels = [i.start() for i in re.finditer("10", l)]
    dels.extend(list(map(lambda x: x+1, dels)))
    # print(dels)
    cnt += len(dels)
    # print(len(dels))
    l = "".join(dellist(list(l), dels))

    dels = [i.start() for i in re.finditer("01", l)]
    dels.extend(list(map(lambda x: x+1, dels)))
    # print(dels)
    cnt += len(dels)
    # print(len(dels))
    l = "".join(dellist(list(l), dels))

print(cnt)