s=raw_input().strip()
pile=[s[0]]
n=len(s)
ans=0
for i in xrange(1,n):
	if pile:
		x=pile.pop()
		if s[i]!=x:
			ans=ans+2
		else:
			pile.append(x)
			pile.append(s[i])
	else:
		pile.append(s[i])
print ans