#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  int ans = 0;
  cin >> s;
  bool tri = true;
  while (tri) {
    for (typeof((s).begin()) i = (s).begin(); i != (s).end(); ++i) {
      if (i + 1 == s.end()) {
        tri = false;
        break;
      }
      if (*i != *(i + 1)) {
        s.erase(i, i + 2);
        ans += 2;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
