#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T GCD(const T x, const T y) {
  if (x < 0) return GCD(-x, y);
  if (y < 0) return GCD(x, -y);
  return (!y) ? x : GCD(y, x % y);
}
template <typename T>
vector<T> DIVISOR(T n) {
  vector<T> v;
  for (long long i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      v.push_back(i);
      if (i != n / i) {
        v.push_back(n / i);
      }
    }
  }
  sort(v.begin(), v.end());
  return v;
}
int A = 0;
int B = 0;
int C = 0;
int N = 0;
int M = 0;
int K = 0;
string S;
int num[30] = {0};
vector<double> x;
vector<string> u;
vector<int> ret;
vector<pair<int, int> > Pair;
long long i, j, k = 0;
long long ans, ans1, ans2 = 0;
void read(void) { cin >> S; }
int main() {
  int max_div = 0;
  int size = 0;
  int sum = 0;
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  read();
  for (i = 0; i < S.size(); i++) {
    if (S.size() == 0) {
      break;
    }
    if (i == S.size() - 1) {
      break;
    }
    if (i < 0) {
      i = 0;
    }
    if (S[i] != S[i + 1]) {
      S.erase(S.begin() + i);
      S.erase(S.begin() + i);
      i -= 2;
      sum += 2;
    }
  }
  printf("%d\n", sum);
  return 0;
}
