#include <bits/stdc++.h>
using namespace std;
const int iinf = 1 << 29;
const long long linf = 1ll << 61;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <class T>
void print(T &x) {
  cout << x << '\n';
  return;
}
template <class T>
long long sized_subset(T &comb) {
  T x = comb & -comb, y = x + comb;
  return ((comb & ~y) / x) >> 1 | y;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int n, a, b, c;
int l[10];
bool used[10];
long long ans = linf;
long long gousei;
int main() {
  char c[100000];
  list<char> s;
  cin >> c;
  for (int i = 0; c[i] != 0; i++) {
    s.push_back(c[i]);
  }
  int ans = 0;
  for (auto ite = s.begin(); ite != s.end(); ite++) {
    auto itebuf = ite;
    if (*ite == *(++itebuf) && itebuf != s.end()) {
      ite = s.erase(ite);
      ite = s.erase(ite);
      ans += 2;
      ite = s.begin();
      ite--;
    }
  }
  cout << ans << endl;
  return 0;
}
