#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  string s;
  cin >> s;
  deque<char> dq;
  ll ans = 0;
  for (ll i = 0; i < s.size(); i++) {
    if (dq.empty()) {
      dq.push_front(s[i]);
    } else {
      if (dq.front() != s[i]) {
        ans += 2;
        dq.pop_front();
      } else {
        dq.push_front(s[i]);
      }
    }
  }
}
