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

# s = list(input())
#
# # print(S)
#
# i = 0
# count = 0
# s_sum = len(s)
#
# while i + 1 < len(s):
#     if s[i] != s[i + 1]:
#         s.pop(i)
#         s.pop(i)
#         i = 0
#         count += 1
#     else:
#         i += 1
#
# print(count * 2)


s = input()

count = 0


while '01' in s or '10' in s:
    s = s.replace('10', ',')
    s = s.replace('01', ',')
    count += s.count(',')
    s = s.replace(',', '')

print(count)





