#include <bits/stdc++.h>
int main() {
  std::string S;
  std::cin >> S;
  int ans = 0;
  auto itr = S.begin();
  while (itr != S.end() - 1) {
    if (*itr != *(itr + 1)) {
      itr = S.erase(itr, itr + 2);
      if (itr - 1 != S.begin()) itr--;
      ans += 2;
      continue;
    }
    itr++;
  }
  std::cout << ans << std::endl;
}
