S = input()
ans = len(S)
def check(S):
	first = S[0]
	for i in range(1,len(S)):
		if first != S[i]:
			S = S[0:i-1] + S[i+1:]
			return S
		else:
			first = S[i]
while 1:
	S = check(S)
	if ('1' in S) and ('0' in S):
		continue
	else:
		print(ans-len(S))
		break
