#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  int i = 0, ans = 0;
  while (n > 1 && i < s.size() - 1) {
    if (s[i] != s[i + 1]) {
      s.erase(i, 2);
      ans += 2;
      n -= 2;
      i = 0;
    }
    i++;
  }
  cout << ans;
}
int main() {
  cout << std::fixed << std::setprecision(10);
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
