#include <bits/stdc++.h>
using namespace std;
int n, k, m, h[100005];
string s;
int main() {
  cin >> s;
  int cnt = 0;
  while (1) {
    bool ok = false;
    for (int i = 0; i < (int)s.size() - 1; i++)
      if (s[i] != s[i + 1]) s.erase(i, 2), cnt++, ok = true;
    if (!ok) break;
  }
  cout << cnt * 2 << endl;
}
