#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char *argv[]) {
  string s;
  cin >> s;
  deque<char> d(s.begin(), s.end());
  int ans = 0;
  while (d.size() >= 2) {
    int idx = 1;
    while (idx < d.size()) {
      if (d[idx] != d[idx - 1]) {
        break;
      }
      idx++;
    }
    if (idx >= d.size()) {
      break;
    }
    d.erase(d.begin() + idx);
    d.erase(d.begin() + idx - 1);
    ans += 2;
  }
  cout << ans << '\n';
  return 0;
}
