#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using P = pair<long long, long long>;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const long long dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const long long INF = 1e12;
const long long MOD = 1e9 + 7;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  string s;
  cin >> s;
  long long res = 0;
  bool update = true;
  while (update) {
    update = false;
    for (long long i = 0; i < (long long)s.size() - 1; i++) {
      if (s[i] != s[i + 1]) {
        update = true;
        s.erase(i, 2);
        res += 2;
      }
    }
  }
  cout << res << endl;
}
