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