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

S = input()
N = len(S)
while True:
	if '01' in S or '10' in S:
		S = remove_01_10(S)
	else:
		print(N - len(S))
		exit()