s = gets.chomp
stack = []
cnt = 0
stack << s[0]
1.upto(s.length-1) do |i|
	c = s[i]
	if stack[-1] == c || stack.length == 0
		stack << c
	elsif stack.length > 0
		# puts "i:#{i}"
		# p stack
		stack.pop
		cnt += 1
	end
end

puts cnt * 2
