#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s=input()
sl=len(s)
if len(s)>1:
  while True:
    ll=len(s)
    s=s.replace('01','')
    s=s.replace('10','')
    if ll==len(s):
      break

print(sl-len(s))

