s = input()
lt = len(s)

tmp = []
for it in range(lt-1):
	tmp.append(s[it:it+2])

it = 0
# print(tmp)
# if "01" in tmp:
# 	it = tmp.index("01")
# 	print(tmp.index("01"))
# 	tmp = tmp[:it-1]+tmp[it+2:]
# print(tmp[:it-1])
# print(tmp[it+2:])
# print(tmp)
count = 0
while True:
	if lt == 1:
		print(0)
		break

	if "01" in tmp:
		it = tmp.index("01")
		# print(tmp.index("01"))
		tmp = tmp[:it-1]+tmp[it+2:]
		count += 2
	elif "10" in tmp:
		it = tmp.index("10")
		# print(tmp.index("10"))
		tmp = tmp[:it-1]+tmp[it+2:]
		count += 2
	else:
		print(lt-len(tmp)*2)
		break
