#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 7;
const long long mod = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  bool jdg = true;
  while (jdg) {
    jdg = false;
    for (long long i = 0; i < (long long)(s.size() - 1); i++) {
      if (s[i] != s[i + 1]) {
        ans += 2;
        s.erase(s.begin() + i, s.begin() + (i + 2));
        jdg = true;
        break;
      }
    }
  }
  cout << ans << endl;
}
