# /user/bin/python
# -*- coding: utf-8 -*-
import sys
 
s = str(input())
s_bef = ""
s_aft = s

while(s_bef != s_aft):
  s_bef = s_aft
  s_aft = s_aft.replace("01", "")
  s_aft = s_aft.replace("10", "")

print(len(s) - len(s_aft))
