def remove_01_10(S):
	S = S.replace('10', '')
	S = S.replace('01', '')
	return S	

S = input()
N = len(S)
for i in range(N):
	if len(S) == len(remove_01_10(S)):
		print(N - len(S))
		exit()
	else:
		S = remove_01_10(S)