S = input()
dic = {"0": 0, "1": 0}

N = len(S)
ind = N-1
now = S[ind]
dic[now] = 1
ans = 0

def rev(s):
	if s == "0":
		return "1"
	else:
		return "0"

if N == 1:
	print(0)
else:
	while ind > 0:
		past = now
		now = S[ind-1]

		dic[now] += 1
		if past != now:
			ans += (dic[past] // 2) * 2
			dic[past] = dic[past] % 2
			if dic[past] == 1:
				dic[now] = 0
		ind -= 1
	dic[S[0]] += 1
	ans += (dic[S[0]] // 2) * 2

	print(ans)
