#include <bits/stdc++.h>
using namespace std;
bool is_prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  string S;
  cin >> S;
  int flag = true;
  int found = false;
  int answer = 0;
  if (S.length() == 1) {
    cout << answer << endl;
    return 0;
  }
  while (flag) {
    found = false;
    for (int i = 0; i < S.length() - 1; i++) {
      if (S[i] != S[i + 1]) {
        answer += 2;
        found = true;
        if (S.length() >= 3) {
          S.erase(S.begin() + i);
          S.erase(S.begin() + i);
          break;
        } else {
          flag = false;
        }
      }
      if (!found && i == S.length() - 2) {
        flag = false;
      }
    }
  }
  cout << answer << endl;
  return 0;
}
