import sequtils

var s = stdin.readLine.mapIt(it)

var
  res = 0
  hasChanged = true

while hasChanged:
  hasChanged = false
  var i = 0
  while i < s.len-1:
    if s[i] != s[i+1]:
      res.inc(2)
      hasChanged = true
      s.delete(i, i+1)
    else:
      i.inc

echo res
