#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  string second;
  cin >> second;
  int cnt = 0;
  bool q = true;
  while (q) {
    bool w = false;
    for (int i = 0; i < second.size() - 1; i++) {
      if (second[i] != second[i + 1]) {
        second.erase(second.begin() + i, second.begin() + i + 2);
        i -= 2;
        cnt += 2;
        w = true;
      }
    }
    q = w;
  }
  cout << cnt;
}
