#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll waz = 76543217;
ll inv(ll x) {
  if (x == 1) {
    return 1;
  }
  if (x == 0) {
    return 0;
  } else {
    ll a = (waz - inv(waz % x) * (waz / x)) % waz;
    if (a >= 0) {
      return a;
    } else {
      return waz + a;
    }
  }
}
void printVector(const vector<int>& vec) {
  for (int value : vec) {
    cout << value << " ";
  }
  cout << endl;
}
vector<ll> p;
ll phi(ll x) {
  ll a = x;
  ll b = x;
  for (ll k = 0; k != p.size(); ++k) {
    if (a % p[k] == 0) {
      while (a % p[k] == 0) {
        a /= p[k];
      }
      b = b / p[k] * (p[k] - 1);
    }
    if (a == 1) {
      break;
    }
  }
  return b;
}
bool my_compare(pair<string, int> a, pair<string, int> b) {
  if (a.first != b.first) {
    return a.first < b.first;
  }
  if (a.second != b.second) {
    return a.second > b.second;
  } else {
    return true;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string S;
  cin >> S;
  ll ka = 0, kak = 0;
  while (1) {
    ka = 0;
    for (int i = 0; i < (int)S.size() - 1; ++i) {
      if (S[i] != S[i + 1]) {
        S.erase(i, 2);
        ++ka;
        ++kak;
      }
    }
    if (ka == 0) {
      break;
    }
  }
  cout << kak * 2 << endl;
}
