S = gets.chomp

ans = 0
cnt = 1
e = S.each_char
c = e.next
loop do
  s = e.next
  if c == s
    cnt += 1
  else
    cnt -= 1
    ans += 2
    if cnt == 0
      cnt = 1
      c = e.next
    end
  end
end
puts ans
