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