s = input()
#s = '11011010001011'
count = 0
while True:
	if s.count('01') > 0:
		s.replace("01","")
		count += 1
	if s.count('10') > 0:
		s.replace("10","")
		count += 1
	if s.count('01') == 0 and s.count('10') == 0:
		break
print(count)