# -*- coding: utf-8 -*-
#ABC120C

import sys
#import math

hoge = input()
#hoge=[]
#for i in range(0,len(tmp)):
#	hoge.append(tmp[i])
#hoge = list(map(lambda a: int(a), tmp))

n = len(hoge)

sum=0
i=0
while(1):
#	print(i)
	if(hoge[i]!=hoge[i+1]):
#		print("hoge:{} i:{} {} {}".format(hoge,i,hoge[i],hoge[i+1]))
		newhoge=hoge[0:i]+hoge[i+2:n]
		hoge = newhoge
		i=max(i-2,-1)
		n=len(hoge)
		sum+=2
#	print(i)
#	print("---")
	i+=1
	if(i>=n-1):
		break


print(sum)
