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